- Angular 2 - Home
- Angular 2 - Overview
- Angular 2 - Environment
- Angular 2 - Hello World
- Angular 2 - Modules
- Angular 2 - Architecture
- Angular 2 - Components
- Angular 2 - Templates
- Angular 2 - Directives
- Angular 2 - Metadata
- Angular 2 - Data Binding
- CRUD Operations Using HTTP
- Angular 2 - Error Handling
- Angular 2 - Routing
- Angular 2 - Navigation
- Angular 2 - Forms
- Angular 2 - CLI
- Angular 2 - Dependency Injection
- Angular 2 - Advanced Configuration
- Angular 2 - Third Party Controls
- Angular 2 - Data Display
- Angular 2 - Handling Events
- Angular 2 - Transforming Data
- Angular 2 - Custom Pipes
- Angular 2 - User Input
- Angular 2 - Lifecycle Hooks
- Angular 2 - Nested Containers
- Angular 2 - Services
Angular 2 Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Angular 2. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - Which of the following is correct about Services?
B - Angular 2 Services cannot be used across multiple applications.
C - Angular 2 Services help to build the applications into many modules.
Answer : A
Explanation
Services are a set of code that can be shared by different components of an application. So for example if you had a data component that picked data from a database, you could have it as a shared service that could be used across multiple applications.
Q 2 - Which of the following is true?
A - Angular 2 Services are used to define the views of an Angular JS application.
B - Angular 2 Templates are used to define the views of an Angular JS application.
C - Angular 2 Components are used to define the views of an Angular JS application.
Answer : B
Explanation
Angular 2 Templates are used to define the views of an Angular JS application.
Q 3 - Which of the following is correct about Bootstrap Array in Angular 2 Modules?
Answer : C
Explanation
Angular 2 Bootstrap array is used to tell Angular which components need to be loaded so that its functionality can be accessed in the application. Once you include the component in the bootstrap array, you need to declare them so that they can be used across other components in the Angular application.
Q 4 - Which of the following is correct about tsconfig.json?
A - This file is used to give the options about TypeScript used for the Angular JS project.
B - This file contains information about Angular 2 project.
C - This file contains the system files required for Angular JS application.
Answer : A
Explanation
tsconfig.json file is used to give the options about TypeScript used for the Angular JS project.
Q 5 - Which of the following is correct about package.json?
Answer : C
Explanation
There are two types of dependencies, first is the dependencies and then there are dev dependencies. The dev ones are required during the development process and the others are needed to run the application.
Q 6 - Which of the following is the correct way to apply a filter?
Answer : C
Explanation
filter are applied using pipe character.
Q 7 - Which of the following filter is used to convert an input string to currency format.
Answer : A
Explanation
currency filter is used to convert an input string to currency format.
Q 8 - Which of the following is correct about lifecycle hook - ngDoCheck.
A - When the value of a data bound property changes, then this method is called.
C - This is for the detection and to act on changes that Angular can't or won't detect on its own.
D - This is called in response after Angular projects external content into the component's view.
Answer : C
Explanation
ngDoCheck method is for the detection and to act on changes that Angular can't or won't detect on its own.
Q 9 - Which of the following is correct about lifecycle hook - ngAfterViewInit.
A - This is called in response after Angular checks the content projected into the component.
B - This is called in response after Angular initializes the component's views and child views.
C - This is called in response after Angular checks the component's views and child views.
D - This is the cleanup phase just before Angular destroys the directive/component.
Answer : B
Explanation
ngAfterViewInit method is called in response after Angular initializes the component's views and child views.