Showing posts with label Angular Fundamentals. Show all posts
Showing posts with label Angular Fundamentals. Show all posts

Sunday, 6 December 2020

Angular MCQ : Angular Fundamentals : Part 3

(1) Which of the following is a limitation of using template based forms?

• You can't validate the values entered into the form fields.

• You can't unit-test your validation logic.

• You can't have multiple validators on a field.


2) Which library contains the Observable class?

• Http

• RxJS

• Core


3) Which of the following is an attribute css selector?

• [selector]

• #selector

• .selector


4) What is the purpose of a mock?

• To allow you to test Http calls

• To place a boundary around tested code

• To allow you to arrange your tests easier


5) What object allows you to create your own tokens?

• The InjectionToken class

• The TransparentToken class

• The Token class


6) Which of the following would you use to display a list of elements in a component template?

• *ngRepeat

• *ngEach

• *ngFor 


7) When is the @Injectable() decorator required on a service?

• Only when it is going to be injected into components

• Only when the service also injects other services

• Only when it is going to be injected into another service


8) What's the best way to add component-specific styles to a component?

• Add the styles to a css file imported by your index.html.

• Reference an external stylesheet from inside your component template html.

• Specify the styles or styleUrls inside the component meta-data config.


9) Which of the following is true about property binding expressions?

• They cannot chain expressions together using semi-colons.

• All of these

• They cannot use the new keyword.

• Assignments using =, +=, etc are not allowed.


10) What is a limitation of multiple slot content projection?

• There is a maximum of three slots.

• The slots must be on the same horizontal.

• The slots cannot exist outside of the parent's DOM tree.



<< Angular Fundamentals part-2    Angular Fundamentals part-4 >>

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.