AngularJS - Quiz - Jan 2016

Descripción

AngularJS Quiz
arunram.krish
Test por arunram.krish, actualizado hace más de 1 año
arunram.krish
Creado por arunram.krish hace casi 9 años
933
0

Resumen del Recurso

Pregunta 1

Pregunta
How do you create an AngularJS module 'myApp' that is dependent on the modules "myApp.c", "myApp.s","myApp.f" and "myApp.d"?
Respuesta
  • 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");

Pregunta 2

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

Pregunta 3

Pregunta
What is the name the directive that is used to initialize angularJS application?
Respuesta
  • ngView
  • ngModule
  • ngRoute
  • ngApp

Pregunta 4

Pregunta
In which AngularJS special component do you place the logic to manipulate DOM?
Respuesta
  • controller
  • directive
  • filter
  • service

Pregunta 5

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

Pregunta 6

Pregunta
What are the phases in AngularJS’ HTML compilation and what is done in each phase?
Respuesta
  • 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

Pregunta 7

Pregunta
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?
Respuesta
  • 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 };

Pregunta 8

Pregunta
Which of the following statements are CORRECT about AngularJS scope?
Respuesta
  • 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”

Pregunta 9

Pregunta
Where all can we place AngularJS directive?
Respuesta
  • Only elements
  • Only attributes
  • Only CSS styles
  • Only Comments
  • All of the above

Pregunta 10

Pregunta
How do you initialize / configure AngularJS $route module? Choose the wrong option from the following list
Respuesta
  • //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>

Pregunta 11

Pregunta
When do you use AngularJS filters?
Respuesta
  • 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

Pregunta 12

Pregunta
When is it recommended to use AngularJS provider?
Respuesta
  • 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

Pregunta 13

Pregunta
Which AngularJS components provides APIs for AJAX and JSONP?
Respuesta
  • $ajax
  • $resource
  • $jsonp
  • $http

Pregunta 14

Pregunta
Which of the following options best describe Karma framework?
Respuesta
  • 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

Pregunta 15

Pregunta
How do you inject a custom Angular scope object into an Angular JS controller “MyController” using ngMock and Jasmine API inside beforeEach ?
Respuesta
  • 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”]); });
Mostrar resumen completo Ocultar resumen completo

Similar

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
Musculos de brazo y antebrazo
Laura Bonilla
MARCO CONCEPTUAL NIIF
johanz4
Sistema Economico
bella_colindres
La Capilla De Los Resurrectos.
Karen Guerrero
VOCABULARIO DE AMOS OZ PNT 2
oriol wagensberg
Texto Narrativo
Diana Banda