Sunday, November 7, 2021

Multiple Choice Questions - Angular2 Components

 1. A component is a class decorated with some metadata and . . . . . . are functions that can modify a class.


A) Selectors
B) Decorators
C) Mentors
D) Bindings

2. Consider the statement "Every component must be declared in one and only one Angular module". Is it true or false?

A) True
B) False

3. . . . . . . . . . . . is a life cycle hook called by Angular2 to indicate that Angular is done creating the component.

A) ngOnChanges
B) ngAfterViewInit
C) ngAfterContentInit
D) ngOnInit

4. Elements present inside the template of a component are called . . . . . . . children.

A) content
B) nested
C) view
D) template

5. Some of the core properties that we required when creating Angular 2 components are

A) Providers
B) Templates & selectors
C) Items
D) Directives

6. ngDoCheck()

A) It is used to override the default change detection algorithm for a directive.
B) It is invoked on every check of your component’s view.
C) It is invoked when the view is completely initialised.
D) It is invoked every time the directive’s content is checked.

7. . . . . . . . . . are used to invoke events on the parent component from child components in the hierarchy of components.

A) Inputs
B) Outputs
C) Blueprints
D) hooks

8. The scope of the component travels through the chain of components. However, components that are defined in the . . . . . . . . . array aren’t injected or inherited by the child components in the hierarchical chain.

A) services
B) singletons
C) parent
D) viewproviders

9. Components are basically directives with views but we cannot implement them by nesting/composing other directives and components.

A) True
B) False

10. Components conduct a provider lookup upwards because each component has its own built-in . . . . . . . , which is specific to it.

A) service
B) instance
C) hook
D) injector

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

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...