
- Angular 2 Tutorial
- 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 Useful Resources
- Angular 2 - Questions and Answers
- Angular 2 - Quick Guide
- Angular 2 - Useful Resources
- Angular 2 - Discussion
Angular 2 Mock Test
This section presents you various set of Mock Tests related to Angular 2. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Angular 2 Mock Test IV
Q 1 - Which of the following filter is used to convert an input string to percentage format.
Answer : B
Explanation
percent filter is used to convert an input string to percentage format.
Q 2 - Which of the following is correct about lifecycle hook - ngOnChanges.
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 : A
Explanation
When the value of a data bound property changes, then ngOnChanges method is called.
Q 3 - Which of the following is correct about lifecycle hook - ngOnInit.
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 : B
Explanation
ngOnInit method is called whenever the initialization of the directive/component after Angular first displays the data-bound properties happens.
Q 4 - 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 5 - Which of the following is correct about lifecycle hook - ngAfterContentInit.
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 : D
Explanation
ngAfterContentInit method is called in response after Angular projects external content into the component's view.
Q 6 - Which of the following is correct about lifecycle hook - ngAfterContentChecked.
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 : A
Explanation
ngAfterContentChecked method is called in response after Angular checks the content projected into the component.
Q 7 - 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.
Q 8 - Which of the following is correct about lifecycle hook - ngAfterViewChecked.
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 : C
Explanation
ngAfterViewChecked method is called in response after Angular checks the component's views and child views.
Q 9 - Which of the following is correct about lifecycle hook - ngOnDestroy.
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 : D
Explanation
ngOnDestroy method is the cleanup phase just before Angular destroys the directive/component.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | A |
3 | B |
4 | C |
5 | D |
6 | A |
7 | B |
8 | C |
9 | D |