AngularJS selftest

What is the purpose of $apply?
Please select exactly one correct alternative.

Answer

$apply() is used to execute an expression in angular from outside of the angular framework.
What is the purpose of $digest()?
Please select exactly one correct alternative.

Answer

Processes all of the watchers of the current scope and its children.
What is the purpose of $watch()?
Please select exactly one correct alternative.

Answer

It registers a listener callback to be executed whenever the watchExpression changes.
What is a digest cycle?
Please select exactly one correct alternative.

Answer

The digest cycle processes all of the watchers of the current scope and its children. Because a watcher's listener can change the model, the $digest() keeps calling the watchers until no more listeners are firing.
What are differences between $apply and $digest?
Please select exactly one correct alternative.

Answer

On $digest, AngularJS evaluates the scope model. On $apply, AngularJS triggers a $digest cycle. If an expression is passed to $apply(), it is evaluated first, before $digest() is executed.
What are differences between $scope and $rootScope?
Please select none ore more correct alternatives.

Answer

Each Angular application has exactly one root scope, but may have several child scopes. When Angular evaluates {{name}}, it first looks at the scope associated with the given element for the name property. If no such property is found, it searches the parent scope and so on until the root scope is reached.
Why should you use $scope variables instead of regular JavaScript (var) variables?
Please select exactly one correct alternative.

Answer

Because AngularJS keeps track of $scope variables.
What is meant by $$phase?
Please select exactly one correct alternative.

Answer

A method that AngularJS uses to start the digest cycle.
What does $setValidity() do?
Please select exactly one correct alternative.

Answer

It changes the validity state, and notify the form.This method can be called within $parsers/$formatters or a custom validation implementation.
What is AngularJS?
Please select exactly one correct alternative.

Answer

AngularJS is an open-source web application framework written in JavaScript, maintained by Google and a community of individual developers and corporations. It is designed for developing single-page applications (SPA's).

Reading

AngularJS
What is a Single Page Application?
Please select exactly one correct alternative.

Answer

A single-page application is a web site that fits on a single web page. Using AngularJS, you can create Single Page Applications.
What does MVC stand for?
Please select exactly one correct alternative.

Answer

MVC stands for Model View Controller. It is a solution pattern allowing to develop applications with loose coupling and separation of concern which in turn improves testability, maintainability and extendibility of the software.
What does MVP stand for?
Please select exactly one correct alternative.

Answer

MVP stands for Model View Presenter. It is a solution pattern allowing to develop applications with loose coupling and separation of concern which in turn improves testability, maintainability and extendibility of the software.
What does MVVM stand for?
Please select exactly one correct alternative.

Answer

MVVM stands for Model View ViewModel. It is a solution pattern allowing to develop applications with loose coupling and separation of concern which in turn improves testability, maintainability and extendibility of the software.
What happens?
Consider the following situation:
You have implemented an AngularJS application in which you use the following code fragment:
$http.get("data.json").success(function(data) { } );
The application resides in a folder on your laptop.
You load the application from your folder into your browser.


What happens?
Please select exactly one correct alternative.

Answer

None of the above is the correct answer because the application throws an error because you have to use a web server (and the http protocol) to load the "data.json" data file.

Reading

$http
What are advantages of Single Page Applications?
Please select none ore more correct alternatives.

Answer

During usage of the web application, the page is dynamically changed, and resources are dynamically loaded and added to the page as necessary without the page being reloaded. This results in a more fluent user experience compared to classic web pages.
What are AngularJS Directives?
Please select exactly one correct alternative.

Answer

AngularJS directives are HTML attributes with an "ng" prefix, like ng-init, ng-app and ng-model.
Which of the statements on AngularJS Directives below are correct?
Please select none ore more correct alternatives.

Answer

All statements on AngularJS Directives are correct.
What is meant by "scope" in AngularJS?
Please select exactly one correct alternative.

Answer

Scope refers to the application model. It acts like glue between application controller and the view. Scopes are arranged in hierarchical structure and impersonate the Document Object Model (DOM) structure of the application. It can watch expressions and propagate events.
What is meant by "services" in AngularJS?
Please select exactly one correct alternative.

Answer

In AngularJS "services" are the Singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these function can be called as controllers, directive, filters and so on.
When should you use AngularJS services?
Please select exactly one correct alternative.

Answer

In AngularJS "services" are the Singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these function can be called as controllers, directive, filters and so on. You use them for implementing specific functionality that is used regularly in your JavaScript code. This makes your controllers' code "lean".
What is AngularJS "binding" or "data binding"?
Please select exactly one correct alternative.

Answer

Data binding is the automatic synchronization (update)of data between the model and view components. The view is a projection of the model at all times. When the model changes, the view reflects the change, and vice versa. So when you update a control's value and this control is bound to a variable, the variable is changed automatically as well.

Reading

Data Binding
What is an AngularJS "expression"?
Please select exactly one correct alternative.

Answer

AngularJS expressions are JavaScript-like code snippets that are usually placed in bindings such as {{ expression }}. There are, however, some differences with JavaScript expressions.
What are valid differences between AngularJS expressions and JavaScript expressions?
Please select none ore more correct alternatives.

Answer

All of the statements above are correct.
Which statements are correct on AngularJS directives?
Please select none ore more correct alternatives.

Answer

An AngularJS directive is like a marker on a DOM element which attaches a special behavior to it. Directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ($compile) to attach a specified behavior to that DOM element or even transform the DOM element and its children.
What is the difference between one way binding and two way binding?
Please select exactly one correct alternative.

Answer

In one way binding, changes in the model will be reflected in the view. In addition to this, in two way binding, changes in the view will be reflected in the model.

Reading

Data Binding
What is Angular Protractor and what is it used for?
Please select exactly one correct alternative.

Answer

Protractor is an end-to-end test framework for AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would.
What is the purpose of AngularJS routes?
Please select exactly one correct alternative.

Answer

AngularJS routing enables to create different URLs for different content in your web application. Each URL in AngularJS is called a route. Having different URLs for different content enables the user to bookmark URLs to specific content, and share those URLs with others, for example:
  • http://angularsap.nl/index.html#contact
  • http://angularsap.nl/index.html#news
  • http://angularsap.nl/index.html#people
What is string interpolation in AngularJS?
Please select exactly one correct alternative.

Answer

In AngularJS, during the compilation process the compiler matches text and attributes using the interpolate service to see if they contains embedded expressions. As part of the normal digest cycle, these expressions are updated and registered as watches.

Reading

$interpolate
In which order AngularJS compiles HTML?
Please select exactly one correct alternative.

Answer

Compilation of HTML process occurs in the following steps:
  • Using the standard browser API, first the HTML is parsed into DOM
  • By using the call to the $compile() method, compilation of the DOM is performed. The method traverses the DOM and matches the directives.
  • Link the template with scope by calling the linking function returned from the previous step

Reading

HTML Compiler
What is AngularJS linking?
Please select exactly one correct alternative.

Answer

Linking combines the directives with a scope and produce a live view. For registering DOM listeners as well as updating the DOM, the link function is responsible. After the template is cloned it is executed.
There are two linking functions:
  • Pre-linking function: Pre-linking function is executed before the child elements are linked. It is not considered the safe way for DOM transformation.
  • Post linking function: Post linking function is executed after the child elements are linked. It is safe to do DOM transformation by post-linking function

Reading

HTML Compiler
What is the purpose of the AngularJS $injector service?
Please select none ore more correct alternatives.

Answer

The $injector service is used to retrieve object instances as defined by provider, instantiate types, invoke methods, and load modules.

Reading

$injector
What is the difference between linking and compiling in AngularJS?
Please select exactly one correct alternative.

Answer

The compile function is used for template DOM manipulation and collect all of the directives. The link function is used for registering DOM listeners as well as instance DOM manipulation. It is executed once the template has been cloned.
What is the purpose of the AngularJS $injector service?
Please select exactly one correct alternative.

Answer

The $injector service is used to retrieve object instances as defined by provider, instantiate types, invoke methods, and load modules.

Reading

$injector
What is the factory method in AngularJS?
Please select exactly one correct alternative.

Answer

For creating a directive, the factory method is used. It is invoked only once, when compiler matches the directive for the first time. By using $injector.invoke the factory method is invoked.
What is Dependency Injection?
Please select exactly one correct alternative.

Answer

Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies. The Angular injector subsystem is in charge of creating components, resolving their dependencies, and providing them to other components as requested.
Which of the statements below on CSS classes added to AngularJS forms are valid?
Please select none ore more correct alternatives.

Answer

AngularJS ngModel adds these CSS classes to allow styling of form as well as control:
  • ng-valid is set if the form is valid.
  • ng-invalid is set if the form is invalid.
  • ng-pristine is set if the form is pristine.
  • ng-dirty is set if the form is dirty.
  • ng-submitted is set if the form was submitted.

Reading

Angular form
Which of the statements below on AngularJS scopes are valid?
Please select none ore more correct alternatives.

Answer

Please read the documentation mentioned in the resources.

Reading

Angular form
In what way(s), an object or function can get a hold of its dependencies?
Please select none ore more correct alternatives.

Answer

These are the ways that object uses to hold of its dependencies:
  • Typically using the new operator, a dependency can be created.
  • By referring to a global variable, a dependency can be looked up.
  • A dependency can be passed into where ever it is required.
Which of the statements below are correct on AngularJS scopes?
Please select none ore more correct alternatives.

Answer

Each AngularJS application consist of one (1) root scope but may have several child scopes. As child controllers and some directives create new child scopes, the application can have multiple scopes. When new scopes are formed or created, they are added as a children of their parent scope. This is similar to DOM in which a hierarchical structure can be created as well.
What is the default behaviour of the ng-init directive?
Please select exactly one correct alternative.

Answer

The ng-init directive initializes application data.
What is an AngularJS promise?
Please select exactly one correct alternative.

Answer

An AngularJS promise (or just a JavaScript promise) is a way for handling asynchronous operations.

1 opmerking:

  1. Really Good blog post.provided a helpful information.I hope that you will post more updates like this AngularJS Online Course

    BeantwoordenVerwijderen