Ads by Google
Get This Adsense Pop-up Window


Friday 18 August 2017

Angularjs upwork test answers (top 10%, 20%) Answers 2019

1. A promise is an interface that deals with objects that are __ or __ filled in at a future point in time (basically, asynchronous actions)?

Answers:

• set, data
• returned, data
• returned, set
• returned, get

2. Which of the following are methods in an instance of $q.defer() ?
Note: There may be more than one right answer.

Answers:

• finally
• when
• notify
• then
• reject
• resolve

3. Which of the following is the correct syntax for using the $q.all method?
Note: There may be more than one right answer.

Answers:

• «`
$q.all([promise1(),promise2]]).then((values) => {

});
«
• «`
$q.all(“promise1”, “promise2”).then((values) => {

});
«`
• «`
$q.all({«promise1″: promise1(),»promise2»: promise2()}).then((values) => {

});
«`

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

Answers:

• extend
• integrate
• render
• connect
• connect

5. Explain $q service, deferred and promises, Select a correct answer?

Answers:

• Promises are post processing logics which are executed after some operation/action is completed whereas ‘deferred’ is used to control how and when those promise logics will execute.
• We can think about promises as “WHAT” we want to fire after an operation is completed while deferred controls “WHEN” and “HOW” those promises will execute.
• “$q” is the angular service which provides promises and deferred functionality.
• All of the above

6. The Promise proposal dictates the following for asynchronous requests?
Note: There may be more than one right answer.

Answers:

• The Promise has a then function, which takes two arguments, a function to handle the “resolved” or “success” event, and a function to handle the “rejected” or the “failure” event
• It is guaranteed that one of the two callbacks will be called, as soon as the result is available
• Async requests return a promise instead of a return value
• The Promise proposal is the basis for how AngularJS structures local

7. How to use AngularJS promises, read the example code?

Answers:

• controller(‘MyCtrl’, function($scope, $q) {
function longOperation() {
var q = $q.defer();
somethingLong(function() {
q.resolve();
});
return q.promise;
}
longOperation().then(function() {
});
})
• controller(‘MyCtrl’, function($scope, $q) {
var lastUrl;
var lastFileName
return {
createPdf(url, fileName){
//do processing
lastUrl = url;
lastFileName = fileName
},
loadLastPdf(){
//use lastUrl and lastFileName
}
}
})
• Both of the above
• None of the above

8. What is ng-hide directive used for?

Answers:

• Show a given control
Hide a given control
• Both of the above
• None of the above

9. What is the output of the following code:

$scope.firstName = «John»,
$scope.lastName = «Doe»
{{ firstName | uppercase }} {{ lastName }}

Answers:

• john doe
• JOHN DOE
• John Doe
• JOHN Doe

10. Which of the following is a valid http get request in AngularJS?

Answers:

• $http.request(«someUrl»)
.then(function(response) {
$scope.content = response.data;
});
• $http({
url : «someUrl»
}).then(function succesFunction(response) {
$scope.content = response.data;
}, function errorFunction(response) {
$scope.content = response.statusText;
});
• $http({
url : “someUrl»
data : «test»
}).then(function succesFunction(response) {
$scope.content = response.data;
}, function errorFunction(response) {
$scope.content = response.statusText;
});
• $http.get(”method=get”,“someUrl”)
.then(function(response) {
$scope.content = response.data;
});

11. Which of the following directive bootstraps AngularJS framework?

Answers:

• ng-init
• ng-app
• ng-controller
• ng-bootstrap

12. AngularJS supports inbuilt internationalization following types of filters?
Note: There may be more than one right answer.

Answers:

• numbers
• date
• currency
• None of the above

13. Which of the following is validation css class in AngularJS?

Answers:

• ng-valid
• ng-invalid
• ng-pristine
• All of the above.

14. Which of the following service is used to handle uncaught exceptions in AngularJS?

Answers:

• $errorHandler
• $exception
• $log
• $exceptionHandler

15. Out of the following which statement is equivalent to
< p ng-bind=»foo «>< /p >

Answers:

• <p>{{foo}}</p>
• <p {{foo}}></p>
• <p>{{«foo»}}</p>
• <p {{«foo»}}></p>

16. Which of the following module is required for routing?

Answers:

• angular.js
• angular-route.js
• angularRouting.js
• route.js

17. Which of the following is not a type of an Angular service?

Answers:

• service
• value
• controller
• provider
• factory
• constant

18. Which of the following is not valid feature for Angular templates?

Answers:

• Routes
• Filters
• Directives
• Forms

19. Dynamically loadable DOM template fragment, called a , through a ?

Answers:

• view, model
• view, route
• view, template
• view, render

20. Which Angular service simulate the ‘console’ object methods from Javascript?

Answers:

• Http
• Log
• Interpolate
• Sce

21. What is Angular Expression, How do you differentiate between Angular expressions and JavaScript expressions?

Answers:

• Context : The expressions are evaluated against a scope object in Angular, while Javascript expressions are evaluated against the global window.
• Forgiving: In Angular expression, the evaluation is forgiving to null and undefined whereas in JavaScript undefined properties generate TypeError or ReferenceError.
• No Control Flow Statements: We cannot use loops, conditionals or exceptions in an Angular expression.
• Filters: In Angular unlike JavaScript, we can use filters to format data before displaying it.
• All of the above

22. Which of the following is true about lowercase filter?

Answers:

• Lowercase filter converts a text to lower case text.
• Lowercase filter converts the first character of the text to lower case.
• Lowercase filter converts the first character of each word in text to lower case.
• None of the above

23. Which of the following is Angular E2E testing tool?

Answers:

• JsTestDriver
• Jasmine
• Nightwatch
• Protractor

24. What is the output of the following code:

$scope.data = [1, 2, 3, 4, 5];
< span ng-repeat=»item in data» ng-if=»item > 5 && item < 10 «>{{ item }}< /span >

Answers:

• 6 7 8 9 10
• 1 2 3 4 5
• Nothing is output

25. What can be following validate data in AngularJS?

Answers:

• $dirty − states that value has been changed.
• $invalid − states that value entered is invalid.
• $error − states the exact error.
• All of the above

26. AngularJS service can be created,registered,created in following different ways?
Note: There may be more than one right answer.

Answers:

• the factory() method
• the value() method
• the service() method
• the provider() method
• None of the above

27. ng-bind directive binds ___.

Answers:

• Data to model.
• View to controller.
• Model to HTML element.
• Model to $scope.

28. What is the output of the following code?

< body ng-app=»myApp» >
< !— directive: my-directive — >
< /body>
var app = angular.module(«myApp», []);
app.directive(«myDirective», function() {
return {
replace : true,
template : «<h1>I got printed</h1>»
};
});

Answers:

• <h1 my-directive=»»>I got printed</h1>
• Blank Screen
• <h1>I got printed</h1>
• <h1 class=»my-directive»>I got printed</h1>

29. What kind of filters are supported the inbuilt internationalization in AngularJS?

Answers:

• currency and date
• currency, date and numbers
• date and numbers
• None of above

30. What is the output of the following code?

< div ng-app=»myApp» >
< h1>{{98 | myFormat}}< /h1>
< /div>
var app = angular.module(‘myApp’, []);
app.service(‘myAlter’, function() {
this.myFunc = function (x) {
return x+’%’;
}
});
app.filter(‘myFormat’,[‘myAlter’, function(myAlter) {
return function(x) {
return myAlter.myFunc(x);
};
}]);

Answers:

• 98%
• 9.8
• 0.98
• 0.98%

31. Which of the following correctly sets a height to 100px for an element?

Answers:

• angular.element(‘#element’).style.height = ‘100px’;
• angular.element(‘#element’).css.height = 100;
• angular.element(‘#element’).css(‘height’, 100);
• angular.element(‘#element’).css(‘height’, ‘100px’);

32. How AngularJS expressions are different from the JavaScript expressions?

Answers:

• Angular expressions can be added inside the HTML templates.
• Angular expressions doesn’t support control flow statements (conditionals, loops, or exceptions).
• Angular expressions support filters to format data before displaying it.
• All of the above

33. Which of the following service components in Angular used to create XMLHttpRequest objects?
Note: There may be more than one right answer.

Answers:

• jsonpCallbacks
• httpParamSerializer
• httpParamSerializerJQLike
• http
• httpBackend
• xhrFactory

34. AngularJS filters ____.

Answers:

• Format the data without changing original data.
• Filter the data to display on UI.
• Fetch the data from remote server.
• Cache the subset of data on the browser.

35. What is the difference beetween watchGroup and watchCollection methods?

Answers:

• The `watchCollection` watch the single object properties, while `watchGroup` watch a group of expressions.
• The `watchCollection` deeply watch the single object properties, while `watchGroup` watch a group of expressions.
• The `watchGroup` deeply watch the single object properties, while `watchCollection` watch a group of expressions.
• The `watchGroup` shallow watch the single object property, while `watchCollection` all object properties.

36. Using the following Custom AJAX property within AngularJs Service?

Answers:

• myApp.factory(‘GetBalance’, [‘$resource’, function ($resource) {
return $resource(‘/Service/GetBalance’, {}, {
query: { method: ‘GET’, params: {}, headers: { ‘beforeSend’: » } }, isArray: true,
});
}]);
• myApp.factory(‘GetBalance’, [‘$resource’, function ($resource) {
return $resource(‘/Service/GetBalance’, {}, {
query: { method: ‘GET’, params: {}, }, isArray: true,
});
}]);
• $.ajax({
type: «GET/POST»,
url: ‘http://somewhere.net/’,
data: data,
beforeSend: »,
}).done().fail();
• All of the above

37. What are the filters in AngularJS, Choose the right answer?

Answers:

• Filters are the rendered view with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using «partials».
• Filters select a subset of items from an array and return a new array. Filters are used to show filtered items from a list of items based on defined criteria.
• It is concept of switching views. AngularJS based controller decides which view to render based on the business logic.
• All of the above

38. What is $rootScope, Choose a True statement?

Answers:

• Scope is a special JavaScript object which plays the role of joining controller with the views. Scope contains the model data. In controllers, model data is accessed via $scope object. $rootScope is the parent of all of the scope variables.
• Scope is a special Php object which plays the role of joining controller with the views. Scope contains the model data. In controllers, model data is accessed via $scope object. $rootScope is the parent of all of the scope variables.
• Scope is a special ASP.Net object which plays the role of joining controller with the views. Scope contains the model data. In controllers, model data is accessed via $scope object. $rootScope is the parent of all of the scope variables.
• All of the above

39. Which of the following is the correct syntax for using filters?

Answers:

• «`
<ul>
<li ng-repeat=»x in names || orderBy:’country’»>
{{ x.name + ‘, ‘ + x.country }}
</li>
</ul>
«`
• «`
<ul>
<li ng-repeat=»x in names && orderBy:’country’»>
{{ x.name + ‘, ‘ + x.country }}
</li>
</ul>
«`
• «`
<ul>
<li ng-repeat=»x in names | orderBy=’country’»>
{{ x.name + ‘, ‘ + x.country }}
</li>
</ul>
«`
• «`
<ul>
<li ng-repeat=»user in users | orderBy:’country’»>
{{ user.name + ‘, ‘ user.country}}
</li>
</ul>
«`

40. The ng-model directive is used for ____.

Answers:

• One-way data binding.
• Two-way data binding.
• Binding view to controller.
• None of the above.

41. What is $rootScope, Choose a True statement?

Answers:

• Scope is a special JavaScript object which plays the role of joining controller with the views. Scope contains the model data. In controllers, model data is accessed via $scope object. $rootScope is the parent of all of the scope variables.
• Scope is a special Php object which plays the role of joining controller with the views. Scope contains the model data. In controllers, model data is accessed via $scope object. $rootScope is the parent of all of the scope variables.
• Scope is a special ASP.Net object which plays the role of joining controller with the views. Scope contains the model data. In controllers, model data is accessed via $scope object. $rootScope is the parent of all of the scope variables.
• All of the above

42. AngularJS directives can be written in HTML element as:

Answers:

• Tag
• Attribute
• Class name
• All of the above.

43. Which of the following statement is True about provider?

Answers:

• provider is used by AngularJS internally to create services, factory etc.
• provider is used during config phase
• provider is a special factory method
• All of the above

44. How you can Get AngularJs Service from Plain Javascript using the following code?

Answers:

• angular.service(‘messagingService’, [‘$rootScope’, ‘applicationLogService’, ‘dialogService’, MessageService]);
• angular.injector([‘ng’, ‘error-handling’]).get(«messagingService»).GetName();
• angular.injector([‘ng’, ‘error-handling’, ‘module-that-owns-dialogService’ ]).get(«messagingService»).GetName();
• All of the above

45. Angular loads into the page, waits for the page to be fully loaded, and then looks for ng-app to define its ___ boundaries?

Answers:

• web
• pages
• filter
• template

46. What is $scope?

Answers:

• It transfers data between a controller and view.
• It transfers data between model and controller.
• It is a global scope in AngularJS.
• None of the above.

47. Which of the following service is used to retrieve or submit data to the remote server?

Answers:

• $http
• $XMLHttpRequest
• $window
• $get

48. Which of the following modules will help with routing in the Angular application?

Answers:

• angularRouter
• ng-view-router
• ngRoute
• viewRouter

49. AngularJS applies some basic transformations on all requests and responses made through its $http service?
Note: There may be more than one right answer.

Answers:

• Request transformations If the data property of the requested config object contains an object, serialize it into JSON format.
• Response transformations If an XSR prefix is detected, strip it. If a XML response is detected, deserialize it using a JSON parser.
• Response transformations If an XSRF prefix is detected, strip it. If a JSON response is detected, deserialize it using a JSON parser.
• None of the above

50. What are the services in AngularJS?

Answers:

• Services are singleton objects which are instantiated only once in app an are used to do the defined task.
• Services are objects which AngularJS uses internally.
• Services are not used in AngularJS.
• Services are server side components of AngularJS.

51. Which of the following methods make $scope dirty-checking?

Answers:

• `$watch, $watchCollection`
• `$digest, $eval`
• `$watch, $apply`
• `$apply, $digest`

52. Which of the following code will clickCount incremented on button click and displayed?

Answers:

• <button ng-click=»clickCount = clickCount + 1″ >
Click me!
</button>
<span> count: {{clickCount}} </span>
• <button on-click=»clickCount = clickCount + 1″ >
Click me!
</button>
<span> count: {{clickCount}} </span>
• <button ng-click=»clickCount = clickCount + 1″ >
Click me!
</button>
<span> count: {clickCount} </span>
• <button on-click=»clickCount = clickCount + 1″ >
Click me!
</button>
<span> count: {clickCount} </span>

53. Which of the following is valid route definition?

Answers:

• app.config(function($ routeProvider) { $routeProvider
.on(«/1», {
templateUrl : «1.htm» })
.on(«/2», {
templateUrl : «2.htm»
})
.otherwise( {
templateUrl : «default.htm»
})
});
• app.config(function($ routeProvider) { $routeProvider
.when(«/1», { templateUrl : «1.htm»
})
.when(«/2», { templateUrl : «2.htm»
})
.otherwise( {
templateUrl : «default.htm»
})
});
• app.config(function($ routeProvider) { $routeProvider
.when(«/1», { templateUrl : «1.htm»
})
.when(«/2», { templateUrl : «2.htm»
})
.default( {
templateUrl : «default.htm»
})
});
• app.config(function($routeProvider) { $routeProvider
.on(«/1», {
templateUrl : «1.htm» })
.on(«/2», {
templateUrl : «2.htm»
})
.default( {
templateUrl : «default.htm»
})
});

54. Which of the following is true about ng-model directive?

Answers:

• ng-model directive binds the values of AngularJS application data to HTML input controls.
• ng-model directive creates a model variable which can be used with the html page and within the container control having ng-app directive.
• Both of the above.
• None of the above.

55. How can you display the elements which contains given pattern of a collection?

Answers:

• <ul>
<li ng-repeat=»item in collection | contains:’pattern’ «>
{{ item }}
</li>
</ul>
• <ul>
<li ng-repeat=»item in collection filter:’pattern’ «>
{{ item }}
</li>
</ul>
• <ul>
<li ng-iterate=»item in collection | filter:’pattern’ «>
{{ item }}
</li>
</ul>
• <ul>
<li ng-repeat=»item in collection | filter:’pattern’ «>
{{ item }}
</li>
</ul>

56. What is the output of the following code:

< div ng-app=»myApp» ng-controller=»myCtrl» >
< p ng-bind=»marks_obtained» ng-if=»(marks_obtained/total_marks)*100 >= 40″ > </ p>
< /div>
var app = angular.module(‘myApp’, []);
app.controller(‘myCtrl’, function($scope) {
$scope.marks_obtained= «60»;
$scope.total_marks = «100»;
});

Answers:

• Pass
• 60
• NaN
• 0.60

57. Which way to hold dependencies in Angular component is more viable ?

Answers:

• The component can create the dependency, typically using the new operator.
• The component can look up the dependency, by referring to a global variable.
• The component can have the dependency passed to it, where it is needed.
• The component can have JSON file with dependencies.

58. Which module is used for navigate to different pages without reloading the entire application?

Answers:

• ngBindHtml
• ngHref
• ngRoute
• ngNavigate

59. In which component is it right way to use the additional libraries? Such as jQuery and etc.

Answers:

• controller
• service
• provider
• directive

60. Which of the following is not a valid for Angular expressions?

Answers:

• Arrays
• Objects
• Function definition
• Strings

61. What is deep linking in AngularJS?

Answers:

• Deep linking allows you to encode the state of application in the URL so that it can be bookmarked.
• Deep linking is a SEO based technique.
• Deep linking refers to linking various views to a central page.
• None of the above.

62. Convenience methods are provided for most of the common request types, including?
Note: There may be more than one right answer.

Answers:

• JSONP
• HEAD
• TRACE
• PUT

63. When are the filters executed in the Angular application?

Answers:

• After each `$digest`.
• Before each `$digest`.
• When their inputs are changed
• When one of their inputs is undefined

64. How is it possible to emit some event?

Answers:

• `$emit()`
• `$on()`
• `$digest`
• `$watch`

65. AngularJS supports i18n/L10n for the following filters out of the box?
Note: There may be more than one right answer.

Answers:

• date/time
• factory
• number
• currency

66. What is the output of the following code:

$scope.x = 20;
{{ x | number:2 }}

Answers:

• 20
• 20.0
• 20.00

67. Which of the following syntax is True of filter using HTML Template?

Answers:

• {( filter_expression filter : expression : comparator : anyPropertyKey)}
• {filter_expression filter : expression : comparator : anyPropertyKey}
• {{ filter_expression | filter : expression : comparator : anyPropertyKey}}
• { filter_expression | filter : expression : comparator : anyPropertyKey}

68. Which of the following custom filters will uppercase every third symbol in a string?

Answers:

• «`
app.filter(‘myFormat’, function() {
return function(x) {
var i, c, txt = «»;
for (i = 0; i < x.length; i++) {
c = x[i];
if (i % 3 == 0) {
c = c.toUpperCase();
}
txt += c;
}
return txt;
};
});
«`
• «`
app.filter(‘myFormat’, function() {
return function(x) {
var i, c, txt = «»;
for (i = 0; i < x.length; i++) {
if (i % 3 == 0) {
c = c.toLowerCase();
}
txt += c;
}
return txt;
};
});
«`
• «`
app.filter(‘myFormat’, function() {
return function(x) {
var i, c, txt = «»;
for (i = 0; i < x.length; i++) {
c = x[i];
if (i % 3 == 0) {
c = c.toUpperCase();
}
txt += c;
return txt;
}
};
});
«`
• «`
app.filter(‘myFormat’, function() {
return function(x) {
var i, c, txt = «»;
for (i = 0; i < x.length; i++) {
c = x[i];
if (i % 3 == 0) {
txt += c;
}
return txt.toUpperCase();
}
};
});
«`

69. Which of the following is the best way to create a shallow copy of an object in Angular?

Answers:

• angular.copy
• angular.extend
• angular.identity
• angular.injector

70. Which directive is responsible for bootstrapping the AngularJS application?

Answers:

• ng-init
• ng-app
• ng-model
• ng-controller

71. Which of the following statements are true?

Answers:

• Expression cannot contain condition, loop or RegEx.
• Expression cannot declare a function.
• Expression cannot contain comma, void or return keyword.
• All of the above.

72. For the given url http://mysite.com:8080/urlpath?q=1 what is the value of the expression below?
var host = $location.host();

Answers:

• mysite.com
• mysite.com:8080
• http://mysite.com
• http://mysite.com:8080

73. How to use AngularJS Promise for some object as following?
Note: There may be more than one right answer.

Answers:

• function getCurrentCall() {
var deferred = $q.defer();
if (!$scope.currentCall) {
$scope.currentCall = ‘foo’;
}
deferred.resolve();
return deferred.promise;
}
• $scope.turnOffLocalAudio = function() {
getCurrentCall().then(function() {
if ($scope.currentCall.chat) {
$scope.currentCall.chat.offLocalAudio(false);
}
}, function() {
// unable to get CurrentCall
});
};
• $scope.turnOffLocalAudio = function () {
if ($scope.currentCall) {
if ($scope.currentCall.chat) {
$scope.currentCall.chat.offLocalAudio(false);
}
}
}
• All of the above

74. What is difference between ng-if and ng-show directives?

Answers:

• When using ng-if or ng-show directive, the hidden elements are placed in DOM with property display: none.
• When using ng-show directive, the hidden elements are placed in DOM with property display: none. directive ng-if includes those elements in DOM, which are equal to the condition. — наиболее подходящее
• When using ng-if directive, the hidden elements are placed in DOM with property display: none. directive ng-show includes those elements in DOM, which are equal to the condition.
• When using ng-if or ng-show directive, in DOM are placed those elements, which are equal to the condition.

75. Which of the following directives changes CSS-style of DOM-element?
Note: There may be more than one right answer.

Answers:

• `ng-class`
• `ng-value`
• `ng-style`
• `ng-options`

76. Data binding in AngularJS is the synchronization between the and the ?

Answers:

• model, view
• model, state
• view, controller
• model, controller

77. Which of the following directive allows us to use form?

Answers:

• ng-include
• ng-form
• ng-bind
• ng-attach

78. How can using ngView directive?

Answers:

• To display the HTML templates or views in the specified routes.
• To display the HTML templates.
• To display the views in the specified routes.
• To display iframes

79. What is the output for the following code?
’30’ + 35

Answers:

• 65
• NaN
• 3035

80. Which of the following statement True of templates in AngularJS?

Answers:

• In Angular, templates are written with HTML that contains Angular-specific elements and attributes. Angular combines the template with information from the model and controller to render the dynamic view that a user sees in the browser. In other words, if your HTML page is having some Angular specific elements/attributes it becomes a template in AngularJS.
• Transfer data to and from the UI:Angular.js helps to eliminate almost all of the boiler plate like validating the form, displaying validation errors, returning to an internal model and so on which occurs due to flow of marshalling data.
• Deep linking allows you to encode the state of application in the URL so that it can be bookmarked. The application can then be restored from the URL to the same state.
• All of the above

81. How is it possible to pass parameters in $http get request?

Answers:

• in property data
• in property params
• in property url
• in property resource

82. What are the services in AngularJS?

Answers:

• Filters select a subset of items from an array and return a new array. Filters are used to show filtered items from a list of items based on defined criteria.
• AngularJS come with several built-in services. For example $http service is used to make XMLHttpRequests (Ajax calls). Services are singleton objects which are instantiated only once in app.
• Templates are the rendered view with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using «partials».
• All of the above

83. What type of the attribute directive data binding is used in code below?

var directive = function(){
return {
scope: {
myParam: ‘@’
}
}
}

Answers:

• Isolate scope one way string binding. Parent changes affect child, child changes doesn’t affect parent
• Isolate Scope two way object binding. Parent changes affect child and child changes affect parent
• Isolate scope object and object literal expression binding
• Isolate scope function expression binding

84. Do I need to worry about security holes in AngularJS?
Note: There may be more than one right answer.

Answers:

• Like any other technology, AngularJS is not impervious to attack. Angular does, however, provide built-in protection from basic security holes including cross-site scripting and HTML injection attacks. AngularJS does round-trip escaping on all strings for you and even offers XSRF protection for server-side communication.
• AngularJS was designed to be compatible with other security measures like Content Security Policy (CSP), HTTPS (SSL/TLS) and server-side authentication and authorization that greatly reduce the possible attack vectors and we highly recommended their use.
• Transfer data to and from the UI:Angular.js helps to eliminate almost all of the boiler plate like validating the form, displaying validation errors, returning to an internal model and so on which occurs due to flow of marshalling data.
• All of the above

85. AngularJS has default headers which it applies to all outgoing requests, which include the following?
Note: There may be more than one right answer.

Answers:

• Accept: application/json, text/plain,
• X-Requested-With: HttpRequest
• X-Requested-With: XMLHttpRequest
• None of the above

86. What makes angular.js better and does?

Answers:

• Registering Callbacks:There is no need to register callbacks . This makes your code simple and easy to debug.
• Control HTML DOM programmatically:All the application that are created using Angular never have to manipulate the DOM although it can be done if it is required.
• Transfer data to and from the UI:Angular.js helps to eliminate almost all of the boiler plate like validating the form, displaying validation errors, returning to an internal model and so on which occurs due to flow of marshalling data.
• No initilization code: With angular.js you can bootstrap your app easily using services, which auto-injected into your application in Guice like dependency injection style.
• All of the above

87. What {{::value}} is mean?

Answers:

• The output value
• Two-way object binding is disabled
• One-way object binding is disabled
• It’s incorrect

88. How to use and register decorators in AngularJS?
Note: There may be more than one right answer.

Answers:

• $tempalte.decorator
• $provide.decorator
• provide.decorator
• module.decorator

89. Pick the correct statement in connection to the ng-include directive?

Answers:

• It is used to embed HTML from an external file
• It is used to embed JS from external files
• Both of the above
• None of the above

90. Which method of $routeProvider redirect to a specific page when no other route definition is matched?

Answers:

• when()
• otherwise()
• redirectTo()
• default()

91. Which of the following provider can be used to configure routes?

Answers:

• $routeProvider
• $url
• $rulesProvider
• None of the above.

92. Select a True statement of RootRouter concept?

Answers:

• The top level Router that interacts with the current URL location
• Displays the Routing Components for the active Route. Manages navigation from one component to the next
• Defines how the router should navigate to a component based on a URL pattern
• An Angular component with a RouteConfig and an associated Router

93. How can you lowercase a given string named examplePattern?

Answers:

• {{ examplePattern filter : lowercase }}
• {{ examplePattern | lowercase }}
• {{ lowercase(examplePattern) }}
• {{ examplePattern | filter : lowercase }}

94. If you want to observe the changes of full object $scope.myObj={one:1, two:2}, what way do you choose?

Answers:

• `$scope.$watch(‘myObj’, function(){ … })`
• `$scope.$on(‘myObj’, function(){ … })`
• `$scope.$watch(‘myObj’, function(){ … }, true)`
• `$scope.$on(‘myObj’, function(){ … }, true)`

95. The ng-change directive must be used with ng-model directives.

Answers:

• True
• False
• Sometimes
• None of the above.

96. Which of the followings are validation directives?

Answers:

• ng-required
• ng-minlength
• ng-pattern
• All of the above.

97. What is service in AngularJS?

Answers:

• Service is reusable UI component.
• Service is a reusable JavaScript Function.
• Service is data provider.
• None of the above.

98. Call angularjs service from simple JS following code?

Answers:

• angular.module(‘main.app’, []).factory(‘MyService’, [‘$http’, function ($http) {
return new function () {
this.GetName = function () {
return «MyName»;
};
};
}]);
angular.injector([‘ng’, ‘main.app’]).get(«MyService»).GetName();
• angular.module(‘app.main’).factory(‘MyService’, [«$http», function ($http) {
return new function () {
this.GetName = function () {
return «MyName»;
};
};
}]);
• Both of the above
• None of the above

99. Which of the following is valid AngularJS application definition?

Answers:

• var myApp = ng.module(‘myApp’,[]); d-)
• var myApp = angular.app(‘myApp’,[]);
• var myApp = angular.module(‘myApp’,[]);
• var myApp = ng.app(‘myApp’,[]);

100. Which of the following isValid AngularJS Expression?

Answers:

• {{ 2+2 }}
• { 2+2 }
• (( 2+2 ))
• { ( 2+2 ) }

102. What is $rootScope?

Answers:

• $rootScope does’t exist
• $rootScope is single root object scope for the app. All other scopes are descendant scope of the root scope.
• $rootScope is single root object scope in each module. All other scopes are descendant scope of the root scope.
• $rootScope and $scope are the same object. Developers decide what they will use.

103. What kind of filters are supported the inbuilt internationalization in Angularjs?

Answers:

• currency and date
• Currency, date and numbers
• date and numbers
• None of above

104. You can invoke a directive by using following example?

Answers:

• <w3-test-directive></w3-test-directive>
• <div w3-test-directive></div>
• <div class=”w3-test-directive”></div>
• <– directive: w3-test-directive –>
• <!– directive: w3-test-directive –>

105. config phase is the phase during which AngularJS bootstraps itself.

Answers:

• True
• False

106. Which of the following is true about currency filter?

Answers:

• Currency filter formats text in a currency format.
Currency filter is a function which takes text as input.
• Both of the above.
• None of the above.