Sunday, November 7, 2021

Multiple Choice Questions - Angular2 Events

 1. Event binding can be defined . . . . . . . . .


A) by wrapping the event in (parenthesis)
B) by prefixing it with in-
C) by wrapping the event in {curly brackets}
D) by prefixing it with on-

2. EventEmitter class acts both as an observer and observable.

A) True
B) False

3. Events in Angular 2 behave like normal DOM events. They can bubble up but cannot propagate down.

A) True
B) False

4. EventEmitter class’s simple interface, which basically encompass two methods . . . . . . . . . can therefore be used to trigger custom events and listen to events as well, both synchronously or asynchronously.

A) exit()
B) superscript()
C) subscribe()
D) emit()

5. Angular framework provides event binding using an in-built events as well as a custom event. Custom events are the EventEmitter instances. To create a custom event we need to create an instance of EventEmitter annotated by . . . . . . .

A) @Input()
B) @Get()
C) @Output()
D) @Set()

6. EventEmitter class is used by directives and components to emit custom Events.

A) True
B) False

7. @Output() myEvent = new EventEmitter();

A) Declares an output property that fires events that you cannot subscribe to with an event binding.
B) Declares an output property that fires events that you can subscribe to with an event binding.
C) Declares an output property that overrides events that you can subscribe to with an event binding.
D) Declares an output property that subscribes to events that you can subscribe to with an event binding.

8. . . . . . . . . need to be passed as a parameter in the event callback from the template to capture the event object.

A) $event.start
B) $events
C) $eventobj
D) $event

9. Calling . . . . . . . . on the event prevents propagation.

A) stopEventPropagation
B) preventEventPropagation
C) stopPropagation
D) preventPropagation

10. Events on child elements are propagated upwards, and hence event binding is also possible on a parent element.

A) True
B) False

Answers
1) a,d, 2) a, 3) b, 4) c,d, 5) c, 6) a, 7) b, 8) d, 9) c, 10) a

No comments:

Post a Comment

Get max value for identity column without a table scan

  You can use   IDENT_CURRENT   to look up the last identity value to be inserted, e.g. IDENT_CURRENT( 'MyTable' ) However, be caut...