AngularJS - Mock Test



This section presents you various set of Mock Tests related to AngularJS Framework. 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.

Questions and Answers

AngularJS Mock Test III

Q 1 - Child controller inherits the scope of its parent controller.

A - true

B - false

Answer : A

Explaination

Child controller inherits the scope of its parent controller.

Answer : D

Explaination

Services are JavaScript functions and are responsible to do specific tasks only. Each service is responsible for a specific task for example, $http is used to make ajax call to get the server data. $route is used to define the routing information and so on. Inbuilt services are always prefixed with $ symbol.

Q 3 - Using service method, we define a service and then assign method to it.

A - true

B - false

Answer : A

Explaination

Using service method, we define a service and then assign method to it.

Q 4 - Using factory method, we first define a factory and then assign method to it.

A - false

B - true

Answer : B

Explaination

Using factory method, we first define a factory and then assign method to it.

Q 5 - factory method is used to define a factory which can later be used to create services as and when required.

A - true

B - false

Answer : A

Explaination

factory method is used to define a factory which can later be used to create services as and when required.

Q 6 - service method is used to create a service whose purpose is to do some defined task.

A - true

B - false

Answer : A

Explaination

service method is used to create a service whose purpose is to do some defined task.

Q 7 - Which components can be injected as a dependency in AngularJS?

A - value

B - factory

C - service

D - All of the above.

Answer : D

Explaination

All of the above can be injected as dependency.

Q 8 - Which components can be injected as a dependency in AngularJS?

A - Application Module

B - constant

C - value

D - factory

Answer : A

Explaination

Application Module can not be injected as dependency.

Answer : D

Explaination

provider is used by AngularJS internally to create services, factory etc. during config phase(phase during which AngularJS bootstraps itself). Below mention script can be used to create MathService that we've created earlier. Provider is a special factory method with a method get() which is used to return the value/service/factory.

Q 10 - config phase is the phase during which AngularJS bootstraps itself.

A - true

B - false

Answer : A

Explaination

config phase is the phase during which AngularJS bootstraps itself.

Q 11 - constants are used to pass values at config phase.

A - true

B - false

Answer : A

Explaination

constants are used to pass values at config phase considering the fact that value cannot be used to be passed during config phase.

Q 12 - Is AngularJS extensible?

A - false

B - true

Answer : B

Explaination

Yes! In AngularJS we can create custom directive to extend AngularJS existing functionalities.

Q 13 - Custom directives are used in AngularJS to extend the functionality of HTML.

A - true

B - false

Answer : A

Explaination

Custom directives are used in AngularJS to extend the functionality of HTML.

Q 14 - Custom directives are defined using "directive" function.

A - true

B - false

Answer : A

Explaination

Custom directives are defined using "directive" function.

Q 15 - On which of the following types of component can we create a custom directive?

A - Element directives

B - Attribute

C - CSS

D - All of the above.

Answer : D

Explaination

AngularJS provides support to create custom directives for following type of elements.

  • Element directives - Directive activates when a matching element is encountered.

  • Attribute - Directive activates when a matching attribute is encountered.

  • CSS - Directive activates when a matching css style is encountered.

  • Comment - Directive activates when a matching comment is encountered.

Q 16 - AngularJS supports inbuilt internationalization for three types of filters currency, date and numbers.

A - true

B - false

Answer : A

Explaination

AngularJS supports inbuilt internationalization for three types of filters currency, date and numbers.

Q 17 - Scope act as glue between controller and view.

A - true

B - false

Answer : A

Explaination

Scopes are objects that refer to the model. They act as glue between controller and view.

Q 18 - Services are singleton objects which are instantiated only once in app.

A - false

B - true

Answer : B

Explaination

Services are singleton objects which are instantiated only once in app.

Q 19 - Filters select a subset of items from an array and return a new array.

A - true

B - false

Answer : A

Explaination

Filters select a subset of items from an array and return a new array.

Q 20 - Templates are the rendered view with information from the controller and model.

A - true

B - false

Answer : A

Explaination

Templates are the rendered view with information from the controller and model.

Q 21 - Templates can be a single file (like index.html) or multiple views in one page.

A - true

B - false

Answer : A

Explaination

Templates can be a single file (like index.html) or multiple views in one page using "partials".

Q 22 - AngularJS applications can run on all major browsers and smart phones including Android and iOS based phones/tablets.

A - true

B - false

Answer : A

Explaination

AngularJS applications can run on all major browsers and smart phones including Android and iOS based phones/tablets.

Q 23 - AngularJS uses dependency injection and make use of separation of concerns.

A - false

B - true

C -

D -

Answer : B

Explaination

AngularJS uses dependency injection and make use of separation of concerns.

Q 24 - AngularJS provides capability to create Single Page Application in a very clean and maintainable way.

A - true

B - false

Answer : A

Explaination

AngularJS provides capability to create Single Page Application in a very clean and maintainable way.

Q 25 - With AngularJS, developer writes less code and gets more functionality.

A - false

B - true

Answer : B

Explaination

With AngularJS, developer writes less code and gets more functionality.

Answer Sheet

Question Number Answer Key
1 A
2 D
3 A
4 B
5 A
6 A
7 D
8 A
9 D
10 A
11 A
12 B
13 A
14 A
15 D
16 A
17 A
18 B
19 A
20 A
21 A
22 A
23 B
24 A
25 B
angularjs_questions_answers.htm
Advertisements