Sunday, 10 January 2021

Angular MCQ : Angular Fundamentals : Part 5

(1) When filtering data, why should you create a copy of the data being filtered?

• To improve performance

• To improve performance

• In case you want to make edits to the data

• To maintain the order between page refreshes

• Otherwise you will lose data


(2) How do you specify where your routed components will appear in your application?

• They always appear just inside the <body> tag of your index.html.

• Use the <router-view> component.

• Use the <router-outlet> component.


(3) Once you have defined routes, how do make the router aware of them?

• Use RouterModule.forRoot or RouterModule.forChild in your Angular module.

• You don't need to make the router aware of them, declaring them as the data type "Routes" is sufficient.

• Import your routes file using a <script> tag in your index.html.

• Add the routes array to the declarations section of your module.


(4) What is the TestBed used for?

• Creating utilities for mocking services

• Integrating HTTP with Tests

• Creating mock child components

• Mimicking a Live Environment for Components


(5) What is Tree Shaking?

• An Optimization algorithm for binary searches

• A way to put multiple pieces of code together

• Automated removal of unused code


(6) When bootstrapping an Angular app, how do you specify the main Angular app module to load?

• Angular discovers the module based on the component that was bootstrapped.

• You load your module directly in your index.html file.

• You add your Angular module as a package in your SystemJs config.

• In your main SystemJs package (e.g. main.ts), you pass your app module into the platformBrowserDynamic.bootstrapModule() method,.


(7) When would you create a custom pipe?

• If you need to format an absolutely positioned node

• If you need to sort and filter your data

• If you need to have some business-specific formatting


(8) Which of the following is used as a container for components, services, directives, etc.?

• Dependency Injection

• An Angular Modules

• SystemJS


(9) Why would you use a setter on an @Input directive?

• To created a derived value on an Input value

• To validate the value of an Input

• To create a read-only input value


(10) How do you specify the html tag (e.g. <event-details>) to use for a component?

• You set the selector property in the component meta-data config.

• You set the tag property in the component meta-data config.

• You name the file that contains your component to match the tag name you want.

• You specify the tag name when declaring the component in your Angular module.


<<Angular Fundamentals part-4

No comments:

Post a Comment