Angular JS MCQs

Angular JS MCQs

Our team has conducted extensive research to compile a set of Angular JS MCQs. We encourage you to test your Angular JS knowledge by answering these 100+ multiple-choice questions provided below.
Simply scroll down to begin!

1: Choose the function that can execute an expression from outside of the Angular framework.

A.   $watchCollection();

B.   $destroy();

C.   $apply();

D.   $evalo();

2:

A developer def‌ines an image tag whose source is evaluated through a binding expression (<img src ='ltimageii' />)- In relation to the image load event, which of the following statements is/are true?
1) A 404 error will be reported by the image tag initially.
2)To prevent the 404 error, ng-src can be used instead of src.
3) ng-src sets the src value of the image as soon as the corresponding binding value gets evaluated.


A.  

Only 2 and 3. 

B.  

Only 1.

C.  

All of them.

D.  

Only1 and 2.

3: Which of the following directives removes or recreates elements of the DOM tree?

A.   ngShow

B.   ngHide

C.   nglf

D.   nglnit

4: if a conditional expression for an ng-if directive on a div element evaluates to false, then which of the following options correctly describes the result of this event?

A.   The div tag will be hidden using CSS properties.

B.   The visibility of the div tag will be made 0 using CSS properties.

C.   The div tag will be entirely removed from the DOM.

D.   The div tag will become visible in the view.

5: Which of the following CSS classes depicts that the user has not yet communicated with the input control?

A.   ng-touched

B.   ng-pending

C.   ng-dirty

D.   ng-pristine

6: Which of the following CSS classes depicts that the state of the input control has been changed by the user?

A.   ng-pristine

B.   ng-touched

C.   ng-lnvalid

D.   ng-dirty

7:

in AnguiarJS. which of the following steps is mandatory to enable routing in your application? Also. you have to check whether these syntaxes are valid or not.

1. include the AngularJS Route module:

2. Add the ngRoute as a dependency in the application module:

var app = angular.module(”myApp”, [“ngRoute"]);


A.  

Both 1 and 2

The syntaxes of both the steps are not valid.


B.  

Both 1 and 2

The syntax of only the second statement is valid.


C.  

Both 1 and 2

The syntax of only the first statement is valid.


D.  

Neither 1 nor 2

The syntaxes of both the steps are not valid.


8: Which of the following is the correct syntax of the jsonp()method of the $http service?

A.   jsonp([lconf‌ig]);

B.   jsonp(url, [config]);

C.   jsonp(url, [config], data]);

D.   jsonp( data. [conf‌ig]);

9: It is given that there is an HTTP service that receives a transmitted JSON f‌ile. In what form will the f‌inal data be?

A.   A string, which is tie-serialized manually using json api to convert it into a json object

B.   A JavaScript object. The http service will de-serialize the received json f‌ile automatically

C.   A special format provided by the http service, especially for angular using the UTF-8 specification.

D.   None of the above.

10: Which of the following is the correct syntax of the whenGE() method of the $httpBackend service?

A.   whenGET(actions, [data]. [headers]);

B.   whenGEfT(url. [headersj] );

C.   whenGET(uri. [headers]. [actions] );

D.   whenGET(actions]. [data]. urli );

11:

Analyze the AngularJS code given in Figure 1 of the image, and choose its correct output from the options given in Figure 2.

A.  

(a)

B.  

(b)

C.  

(C)

12:

The following AngularJS expression is used to get data from a server. Which of the given statements is correct?

var data = $http.get(uri):


A.  

"data" is an http response object.

B.  

The get() method in the given code returns a string containing the server response data 

C.  

A promise object is returned by the geto method in the given code.

D.   "data" is a deferred object.

13: AngularJS expressions are written inside which of the following symbols?

A.   (())

B.   {()}

C.   {{}}

D.   [()]

14: In the hierarchy of scope with the parent being at one level higher than the children, which of the following types of scope occupies the highest level?

A.   Master Scope

B.   Root Scope

C.   Directive Scope

D.   Controller Scope

15: Which of the following services is used to create the root scope during the application bootstrap?

A.   $init

B.   $watch

C.   $injector

D.   sapply

16: The ngChange expression in AngularJS is evaluated:

A.   Only when the input value is invalid continuously since the model will stay null.

B.   Only when the model has modif‌ied programmatically and not by changing the input value.

C.   Only when there is no modif‌ication in the value that is returned from the sparsers transformation pipeline.

D.   Only when a modif‌ication in the input value causes a new value to be committed to the model.

17: Which of the following methods can be used to create a service?

A.   Only factory

B.   Only service

C.   Both factory and service

18: The Snormalize(name) method. pref‌ixed with data-, converts an attribute name to which form?

A.   Normalized, lowercase form

B.   Normalized, uppercase form

C.   Normalized, camelcase form

D.   Normalized, propercase form

19: What is the use of Sinjector in AngularJS?

A.   It is a service locator that is used to retrieve the name of the module to be created.

B.   It is a function that is used to reload the current application with debug information turned on.

C.   It is a service locator that is used to retrieve object instances.

D.   It is a function that is used to determine the undef‌ined reference.

20: Which of the following is NOT a correct ability added by the Factory recipe?

A.   Service initialization

B.   Fast initialization

C.   Ability to use other services (have dependencies)

21: ln Distributed Architecture Structure. which of the following conditions addresses the issue of data ownership at a storage location?

A.   The data available in different storage devices is moved to the cloud.

B.   The data that occupies a large memory space is deleted.

C.   The storage devices owned by the data owners can be moved next to the big data centers for fast path access to compute clusters.

D.   None of the above.

22: Which of the following ways can be used in AngularJS to send AJAX requests to the server?

A.   REST API calls.

B.   JSONP calls through the $http service.

C.   AJAX calls through the $http service.

D.   Both a and c.

E.   a. b and c.

23: Which of the following is NOT one of the special variables def‌ined by the ng-repeat directive?

A.   $index

B.   $next

C.   $f‌irst

D.   $last

24:

Suppose that you used the following statement to create a scope variable in AngularJS.

var p = $root$copez

If you want to create a child of "p" but don't want it to inherit the scope of "P". then which of the following options must be followed?

A.  

The "inherit' parameter in the $newo function must be 'false" while creating the child.

B.  

The “isolate“ parameter in the Snew() function must be "true“ while creating the child.    

C.  

The “isolate“ parameter in the Snew() function must be "true“ while creating the child.    

D.  

The child will never inherit its parent's scope.

25: Which of the following Shttp functions CANNOT take a "data" parameter?

A.   $http.get()

B.   [l $http.put0

C.   $http.post()

D.   $http.delete0

26: Which of the following is the correct syntax of the whenPUT() method of the $htthackend service?

A.   whenPUT(url, [headers]. [actions] ):

B.   whenPUT(http method, [headers], url, [data] );

C.   whenPUT(actions. [data]. [headers]);

D.   whenPUT(url, [data], [headers]);

27: Which of the given parameters of $resource() are optional?

A.   url

B.   paramDefaults

C.   Actions

D.   options

28: Which object does the $http.get() function return?

A.   conf‌ig

B.   Url

C.   response

D.   Promise

29: in Distributed Architecture Structure. which of the following layers is used to establish and delete the network connections?

A.   Service

B.   Transport

C.   Both options a and b

D.   Neither option a nor b

30:

Consider that a service called Shttp makes server calls. Which of the following examples about the dependency injection in AnguiarJS is correct?

Example 1:

function fetchDashboard Data()

[

var $http = new HttpServicel);

return Shttp.get(

A.  

Both options a and b 

B.  

Neither option a nor b

31:

The following snippet is used in an HTML f‌ile to insert the angular.js framework f‌ile:

"