Sunday 6 December 2020

Angular MCQ : Angular Fundamentals : Part 2

 1) What are decorators used for?

• To give a DOM node additional functionality

• To create sub-components

• To create smaller components


2) What is one advantage of RxJS over Promises?

• They can handle a stream of data instead of just one value.

• They are more performant.

• They are simpler.


3) When bootstrapping an Angular app, how do you specify the main, top-level app component to be used?

• You load the component directly in your index.html file.

• You add the component as a package in your SystemJs config.

• You add the component to the bootstrap array in your main app module.


4) When adding styles to a component's styles property, how do you avoid those styles affecting Html outside of your component?

• You must declare your styles inside the component's template.

• You don't need to do anything, Angular takes care of this for you by default.

• You must namespace your classes so they don't affect things outside your component.


5) What functionality do Angular 1 filters have that is missing from Pipes?

• Sorting & Filtering Data

• Working with Promises

• None of these


6) When would you use the useFactory provider method?

• When you need to parameterize the construction of a service

• When you want multiple instances of a service

• When you are using a custom service.

7) If an object could potentially be shown/hidden frequently, what's the best way to handle its visibility?

• Bind to the [hidden] property of the element.

• Use *ngSwitch to hide the element.

• Use *ngIf to hide the element.


8) Custom validators are implemented with which object?

• A Detective

• A Pipe

• A Component


9) What are the two types of Integrated tests?

• Mocked & Functional

• Deep & Shallow

• Deep & End to End


10) When validating an Angular form, how can you only show a validation message if the user has edited a form control?

• Check the control's touched property.

• Check the control's dirty property.

• Bind to the "change" event of the corresponding field and track whether the field has been changed.

No comments:

Post a Comment