Quiz Angular Basic
Start Quiz
Test your knowledge with W3docs’ basic quiz made especially for beginners in Angular. Pass the test and get a Certificate of achievement!
The Test
The test contains 20 questions and there is no time limit. The test is not official, it’s just a nice way to see how much you know about Angular.
Count Your Score
You will get 5% for each correct answer. At the end of the Quiz, your total score will be displayed out of 100% maximum score.
Enrich your knowledgeAt the end of the quiz you can see all the questions with the right answers. There will also be notes about the answers which will lead you to the appropriate page on the platform to enrich your knowledge. Read our HTML tutorial if you are not sure that you are ready for the quiz.
Quiz Answers
What will be the result of the below program?
function f(input: boolean) {
let a = 100;
if (input) {
let b = a + 1;
}
return b;
}
Undefined
101
Compilation error for a
Compilation error for b
Ans. Compilation error for b
In Angular, you can pass data from the parent component to the child component by using:
@Output()
@Input()
Input
Output
Ans. @Input()
In Angular, you can pass data from the child component to the parent component by using:
@Output()
@Input()
Input
Output
Ans. @Output()
Which directive connects the value of the controls to the data?
ng-app
ng-init
ng-model
Ans.
ng-model
Which directive modifies DOM hierarchy?
Structural directive
Attribute directive
Ans. Structural directive
Which is the correct form control class name that is set to true via [(ngModel)] whenever value is changed?
.ng-invalid
.ng-pending
.ng-pristine
.ng-dirty
Ans. .ng-dirty
How many instances of service will be created if you provide a custom service in two components’ “providers” section of @Component decorator?
1
2
3
4
Ans. 2
Custom pipe can modify actual value of variable apart from different presention in HTML.
True
False
Ans. False
In Angular routing, which tag is used to render matched component via active route?
Ans. router-outlet></router-outlet
Which method of RouterModule should be called for providing all routes in AppModule?
RouterModule.forChild
RouterModule.forRoot
RouterModule
RouterModule.import
Ans. RouterModule.forRoot
Async Pipe subscribes to observer and updates expression whenever there is data sent from observer.
True
False
Ans. True
Which command is used to run the Static Code analysis of Angular application?
ng build
ng profile
ng lint
ng serve
Ans. ng lint
Router service needs to be explicitly provided in angular module to use it in another component via DI.
True
False
Ans. False
You can chain multiple pipe in a single expression along with “async” pipe.
True
False
Ans. True
Which component represents “target/host” DOM element inside Directive’s constructor?
Element
ElementRef
Host
Target
Ans. ElementRef
Which command must be used to build an application in production mode?
ng build
ng serve
ng build –prod
ng lint
Ans. ng build –prod
Which decorator does the directive use to listen to the host/target events?
@Listener
@HostListener
@OnListener
@TargetListener
Ans. @HostListener
Which wild card is used to define the page not found route?
*
**
404
^
Ans. **
There can be more than one element in Angular application.
True
False
Ans. True
Which service can be used to extract route parameters inside component?
Router
Route
ActivatedRoute
CurrentRoute
Ans. ActivatedRoute