AngularJS - Quiz - Jan 2016

Descrição

AngularJS Quiz
arunram.krish
Quiz por arunram.krish, atualizado more than 1 year ago
arunram.krish
Criado por arunram.krish quase 9 anos atrás
933
0

Resumo de Recurso

Questão 1

Questão
How do you create an AngularJS module 'myApp' that is dependent on the modules "myApp.c", "myApp.s","myApp.f" and "myApp.d"?
Responda
  • var myApp = angular.createModule("myApp") .inject("myApp.c", "myApp.s","myApp.f" ,"myApp.d");
  • var myApp = angular.module("myApp") .inject("myApp.c", "myApp.s","myApp.f" ,"myApp.d");
  • var myApp = angular.module("myApp", ["myApp.c", "myApp.s","myApp.f" ,"myApp.d"]);
  • var myApp = angular.module("myApp", "myApp.c", "myApp.s","myApp.f" ,"myApp.d");

Questão 2

Questão
What are the 5 recipe types apart from the special recipes to create components in AngularJS module?
Responda
  • Value, Factory, Service, Provider, Constant
  • Singleton, Factory, Service, Provider, Literal
  • Singleton, Module, Service, Provider, Constant
  • Value, Builder, Prototype, Provider, Constant

Questão 3

Questão
What is the name the directive that is used to initialize angularJS application?
Responda
  • ngView
  • ngModule
  • ngRoute
  • ngApp

Questão 4

Questão
In which AngularJS special component do you place the logic to manipulate DOM?
Responda
  • controller
  • directive
  • filter
  • service

Questão 5

Questão
Which function should I invoke to refresh the view, if I modify an attribute in the angular scope outside angularJS context?
Responda
  • angular.refresh();
  • scope.refresh();
  • controller.apply();
  • scope.apply();

Questão 6

Questão
What are the phases in AngularJS’ HTML compilation and what is done in each phase?
Responda
  • Bootstrap: Loads angular application module, with all its dependent modules along with ngCore modules Execute: Executes HTML view created after compilation
  • Compile: Compiles HTML template to create AngularJS view with binding Execute: Executes AngularJS view listening to DOM events for triggers
  • Compile: Identifies / matches directives in HTML DOM Sort: Sorts directives based on priority and a combined link function is created Link: Links specific instance of scope to template, registers listeners on DOM elements, sets up required $watch with the scope
  • Bootstrap: Loads angular application module, with all its dependent modules along with ngCore modules Link: Links specific instance of scope to template, registers listeners on DOM elements, sets up required $watch with the scope

Questão 7

Questão
Which of the following ways is /are INCORRECT to create an AngularJS controller in the AngularJS module – “appModule” – dependent on components registered with following names – svc, $scope, $http, myValue, myConstant?
Responda
  • var myController = appModule.controller(“myController”, [“svc”, “$scope”, “$http”, “myValue”, “myConstant”, function(svc, $scope, $http, myValue, myConstant) { //TODO define controller’s constructor body here }]);
  • var MyController = function(svc, $scope, $http, myValue, myConstant) { //TODO define controller’s constructor body here }; MyController.$inject([“svc”, “$scope”, “$http”, “myValue”, “myConstant”]); appModule.controller(“myController”,MyController);
  • var myController = appModule.controller(“myController”, function(svc, $scope, $http, myValue, myConstant) { //TODO define controller’s constructor body here };
  • var myController = appModule.controller(“myController”, function() { var svc = appModule.lookup(“svc”); var $scope = appModule.lookup(“$scope”); var $http = appModule.lookup(“$http”); var myValue = appModule.lookup(“myValue”); var myConstant = appModule.lookup(“myConstant”); //TODO define controller’s constructor body here };

Questão 8

Questão
Which of the following statements are CORRECT about AngularJS scope?
Responda
  • AngularJS creates a $rootScope when it encounters ngApp directive in the loaded HTML template.
  • AngularJS scopes are hierarchical where in child scope inherit from its parent scope through prototype chain
  • All AngularJS scopes including “isolated” scope inherits prototypically from its parent scope
  • Scope provides $apply to watch model change and $watch to propagate model changes from outside “Angular realm”

Questão 9

Questão
Where all can we place AngularJS directive?
Responda
  • Only elements
  • Only attributes
  • Only CSS styles
  • Only Comments
  • All of the above

Questão 10

Questão
How do you initialize / configure AngularJS $route module? Choose the wrong option from the following list
Responda
  • //no need to download angular-route separately as it is part of ngCore <script> var appModule = angular.module("myapp",['ngRoute']); appModule.map($route, “myURL1”, “partials/myPartial1.html”, partial1Controller); //TODO map remaining URLs </script>
  • <script src="bower_components/angular-route/angular-route.js"></script> <script> var appModule = angular.module("myapp",['ngRoute']); appModule.config(['$routeProvider', function($routeProvider) { //TODO configure route with URL mapping }]); </script>
  • <script src="bower_components/angular-route/angular-route.js"></script> <script> var appModule = angular.module("myapp",['ngRoute']); $route.$inject(['$routeProvider', function($routeProvider) { //TODO configure route with URL mapping }]); </script>
  • <script src="bower_components/angular-route/angular-route.js"></script> <script> var appModule = angular.module("myapp",['ngRoute']); $route.$inject(['urlMappings', {“url1” : {“partial1.html” : “url1template.html”, “controller”: url1Controller}, “url2” : {“partial2.html” : “url2template.html”, “controller”: url2Controller} } ]); </script>

Questão 11

Questão
When do you use AngularJS filters?
Responda
  • Sorting a list of javascript objects based on a property in the object
  • Displaying a text in the selected language
  • Convert <div> element to <span> element
  • Filter DOM elements based on CSS selector

Questão 12

Questão
When is it recommended to use AngularJS provider?
Responda
  • Reusable component that needs to be configured before it can be injected into other angular JS components
  • Component to manipulate your URL
  • Component to interact with HTTP server
  • All of the above

Questão 13

Questão
Which AngularJS components provides APIs for AJAX and JSONP?
Responda
  • $ajax
  • $resource
  • $jsonp
  • $http

Questão 14

Questão
Which of the following options best describe Karma framework?
Responda
  • Karma records user interactions on the browser and can be replayed
  • Karma is a command-line javascript test runner in which any of the testing framework can be plugged in to execute test cases
  • Karma is a testing framework that provides APIs to test Angular JS components
  • Karma is a browser plugin to debug and test AngularJS application

Questão 15

Questão
How do you inject a custom Angular scope object into an Angular JS controller “MyController” using ngMock and Jasmine API inside beforeEach ?
Responda
  • var scope; beforeEach(function(){ module('appModule'); inject(function($controller, $rootScope){ scope = $rootScope.$new(); $controller('MyController',{$scope:scope}); }); //TODO set state in scope });
  • var scope; beforeEach(function(){ module('appModule'); var myController = angular.controller(“MyController”, [“scope”, function($scope){ //TODO set state in scope }]); });
  • var scope; beforeEach(function(){ module('appModule'); angular.controller(‘MyController’). inject(function($rootScope){ scope = $rootScope.$new(); //TODO set state in scope }); });
  • var scope; beforeEach(function(){ module('appModule'); var myController = angular.controller(“MyController”); myController.$inject([“scope”]); });

Semelhante

Front-End Web Development
Chanthy Ngin
Angular Nuts and Bolts
James Drummond
AngularJS
Akhil Sree Nivas
Directives, compile and link
James Drummond
How Angular works
James Drummond
DIREITO PROCESSUAL PENAL
Joelma Silva
Conhecimentos algébricos
Sem Parar
Roma Antiga
Ighor Ferreira
EA-HSG-2015 Questões achadas no app QUIZADA na playstore
carloshenriquetorrez .
Transformações Químicas e Físicas
Andrea Barreto M. Da Poça
Apresentação da aula 1 - Desenvolvimento Humano e Social - Saúde
Emmanuela Pimenta