Angular Quiz
"Which of the following snippets correctly uses event-binding according to Angular 2 syntax: <button (click)=""func"">... <button click=""func""> ... <button [click]=""func""> <button onclick=""func""> "
"<button (click)=""func"">... "
"Which of the following correctly uses property binding: <img src=""{{ value }}"" /> <img src=""value"" /> <img src=value /> <img [src]=""value"" /> <img (src)=""value"" /> "
"<img [src]=""value"" /> "
"What is the result of {{ ""1 + 9"" }}? 1 FALSE 1 + 9 10 "
1 + 9
Which of the following decorators is the one used to specify metadata for the root module? @NgModule @Module @Component @Injectable
@NgModule
Which of the following libraries defines the @Component decorator? (Choose the best option) @angular/core @angular/http @angular/component @angular/directives
@angular/core
In Angular, a router module is An injectable singleton composing related application logic. A file used to declare the various files that make up an Angular module. A modularized portion of a user interface, composed of template, styles, and a TypeScript class. A TypeScript object that defines how various URLs map to views.
A TypeScript object that defines how various URLs map to views.
An Observable is A synchronous stream of data that can be subscribed to. An asynchronous stream of data which can be subscribed to. An array of data which can be processed immediately by many components. An object representing a subscription to an asynchronous stream of data.
An asynchronous stream of data which can be subscribed to.
True of False. ngModel, ngClass, and ngStyle are examples of structural directives. TRUE FALSE
FALSE
True or False. A template is a collection of data values you pass to a component. TRUE FALSE
FALSE
True or False. Directives which alter the DOM like ngFor or ngIf are examples of attribute directives. TRUE FALSE
FALSE
True or False. The root module must be named AppModule. TRUE FALSE
FALSE
True or False. ngClass is used to add/remove multiple styles using key/value pairs of CSS TRUE FALSE
FALSE
True or False. ngFor is used to toggle display of an element. TRUE FALSE
FALSE
True or False. ngIf does NOT remove the element from the DOM if the expression evaluates to false. TRUE FALSE
FALSE
A service can be injected into a component by Simply importing it at the top of the component's TS file. Including it as a private parameter in the ngOnInit method. Including it as a private parameter in the constructor method. Services can't be injected.
Including it as a private parameter in the constructor method.
When data is pushed to a subject it is Stored in the subject until it is popped from it. Is delivered to only one subscriber. Is delivered to all subscribers. You cannot push to a subject.
Is delivered to all subscribers.
What type of object do the request methods of the HttpModule return? Observable Promise Request Response
Observable
The routerLink property is used to Declare a route. Provide a link to a route. Provide a location where routed components will appear in the view. Turn off routes.
Provide a link to a route.
The router-outlet tag is used to Declare a route. Provide a link to a route. Provide a location where routed components will appear in the view. Turn off routes.
Provide a location where routed components will appear in the view.
True of False. Two-way Data-binding is like property-binding and event-binding together. TRUE FALSE
TRUE
True or False. A Component is a specialized Directive. TRUE FALSE
TRUE
True or False. A Logging Service is a type of feature that may be injected into another class. TRUE FALSE
TRUE
True or False. A component is an important feature in Angular 2. TRUE FALSE
TRUE
True or False. Angular 2 supports TypeScript. TRUE FALSE
TRUE
True or False. Angular will match the selector property of the root component to an element in index.html during the bootstrapping process TRUE FALSE
TRUE
True or False. Bootstrapping is the process during which your Root Component is inserted into the DOM. TRUE FALSE
TRUE
True or False. Event-binding associates DOM events to component functions. TRUE FALSE
TRUE
True or False. Modules are used to organize code in features or related functionality in order to prevent code bloat and promote code reuse. TRUE FALSE
TRUE
True or False. Property-binding and interpolation can be used to set an element's property for string values. TRUE FALSE
TRUE
True or False. The AppComponent is typically the name for an Angular 2 application's root component. TRUE FALSE
TRUE
True or False. You typically define one root module and typically define additional features of your application as other modules tied into your root module. TRUE FALSE
TRUE
Which of the following languages does Angular 2 employ? (Choose the best answer) JavaScript TypeScript Java ActionScript VBScript
TypeScript
Metadata is: (Choose the best option to complete the sentence) the association of data/events with elements and user interactions elements, attributes and CSS style classes that you bind on your HTML templates a set of instructions solely dedicated towards presentation logic a collection of data values that you pass to a component
a collection of data values that you pass to a component
Interpolation is: (Choose the best option to complete the sentence) a way to display data from your Angular code on your templates a set of instructions solely dedicated towards presentation logic a collection of data values that you pass to a component the association of data/events with elements and user interactions
a way to display data from your Angular code on your templates
Which of the following files is typically used to link your application's components? app.component.ts app.module.ts main.ts main.js
app.module.ts
Which function does the Response object provide to help handle errors? json().data json() catch() handle() errors()
catch()
What form of data-binding does Angular not support? One-way data binding, known as interpolation two-way data binding database binding event binding property binding
database binding
Which properties do you specify on @NgModule? (Choose all that apply) definitions components declarations services imports
declarations imports
Which of the following are specified as part of the declarations property of @NgModule? (Choose all that apply) components directives pipes services other modules
directives components
Services are: (Choose the best option to complete this sentence) elements, attributes and CSS style classes that you bind on your HTML templates a set of instructions solely dedicated towards presentation logic a collection of data values that you pass to a component features or values that you want defined in one location but in general are used throughout your application
features or values that you want defined in one location but in general are used throughout your application
Which of the following is valid usage of the get() method? (Choose all that apply) http.get(url); http.get(url, requestOptions); http.get(url, requestOptions, body); http.get(url, body, requestOptions);
http.get(url, requestOptions);
Which of the following files provides compilation information for an Angular2 application? app.component.ts app.module.ts main.ts main.css
main.ts
Which of the following are attribute directives? (Choose all that apply) ngModel ngClass ngFor ngIf
ngModel ngClass
Which of the following are specified as part of the imports property of @NgModule? (Choose all that apply) components. directives pipes services other modules
other modules
Services must be registered in the module file in the declarations section imports section providers section bootstrap section
providers section
Which of the are valid properties of the @Component decorator? (Choose all that apply) selector template id animations templateUrl
selector template animations templateUrl
Which of the following metadata specifies the path to the file that defines the HTML to output? animations exportAs providers template templateUrl
templateUrl
Data-binding is: (Choose the best option to complete this sentence) the association of data/events with elements and user interactions elements, attributes and CSS style classes that you bind on your HTML templates a set of instructions solely dedicated towards presentation logic a collection of data values that you pass to a component
the association of data/events with elements and user interactions
This type of binding requires the FormsModule and utilizes square brackets and parenthesis together One-way data binding, known as interpolation two-way data binding using ngModel database binding event binding property binding
two-way data binding using ngModel
Assume you have the following code: @Component { selector: 'my-app', template: '<h1>Hello [interpolation here] </h1>' } export class Component AppComponent { name = 'World'; } Which of the following is the best way to use interpolation to present the name property in the space [interpolation here]? {{ name }} { name } {{ person.name }} { person.name}
{{ name }}
Which module defines functionality for running your application in a web browser? (Choose the best option) HTTPModule BrowserModule AJAXModule HTMLModule
BrowserModule