Week 9 QC Angular Quiz Multiple Choice Flashcards

1
Q

What type of object do the request methods of the HttpModule return?

Observable

Promise

Request

Response
A

Observable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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);
A

http.get(url, requestOptions);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which function does the Response object provide to help handle errors?

json().data

json()

catch()

handle()

errors()
A

catch()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following files provides compilation information for an Angular2 application?

app.component.ts

app.module.ts

main.ts

main.css
A

main.ts

Explanation : main.ts specifies how to compile the application and specifies the main module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following files is typically used to link your application’s components?

app.component.ts

app.module.ts

main.ts

main.js
A

app.module.ts

Explanation : app-module.ts defines the AppModule component. It is the root module and will link all other components of your application here

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

the association of data/events with elements and user interactions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

a collection of data values that you pass to a component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

features or values that you want defined in one location but in general are used throughout your application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

a way to display data from your Angular code on your templates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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 }}

{{ person.name }}

{ person.name}

{ name }

A

{{ name }}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which properties do you specify on @NgModule? (Choose all that apply)

definitions

components

declarations

services

imports

A

imports

Explanation : Correct. The three main properties that you specify inside @NgModule are declarations, bootstrap and imports. There are others used for specifying services and other constructs. Definitions, components and services, however, are not valid properties of @NgModule

declarations

Explanation : Correct. The three main properties that you specify inside @NgModule are declarations, bootstrap and imports. There are others used for specifying services and other constructs. Definitions, components and services, however, are not valid properties of @NgModule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following decorators is the one used to specify metadata for the root module?

@NgModule

@Module

@Component

@Injectable

A

@NgModule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following are specified as part of the declarations property of @NgModule? (Choose all that apply)

components

directives

pipes

services

other modules
A

components

directives

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following are specified as part of the imports property of @NgModule? (Choose all that apply)

components

directives

pipes

services

other modules

A

other modules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following snippets correctly uses event-binding according to Angular 2 syntax:

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following correctly uses property binding:

<img></img>

<img></img>

<img></img>

<img></img>

<img></img>

A

<img></img>

17
Q

Which of the following are attribute directives? (Choose all that apply)

ngModel

ngClass

ngFor

ngIf

A

ngModel

ngClass

18
Q

Which of the following libraries defines the @Component decorator? (Choose the best option)

@angular/core

@angular/http

@angular/component

@angular/directives

A

@angular/core

Explanation : Correct. The @angular/core library defines the @Component decorator

19
Q

Which of the are valid properties of the @Component decorator? (Choose all that apply)

selector

template

id

animations

templateUrl

A

selector

template

templateUrl

20
Q

Which of the following metadata specifies the path to the file that defines the HTML to output?

animations

exportAs

providers

template

templateUrl

A

templateUrl

21
Q

Which module defines functionality for running your application in a web browser? (Choose the best option)

HTTPModule

BrowserModule

AJAXModule

HTMLModule
A

BrowserModule

22
Q

What is the result of {{ “1 + 9” }}?

1

FALSE

1 + 9

10
A

1 + 9

23
Q

Which of the following languages does Angular 2 employ? (Choose the best answer)

JavaScript

TypeScript

Java

ActionScript

VBScript
A

TypeScript

24
Q

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

A TypeScript object that defines how various URLs map to views.

25
Q

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
A

database binding

26
Q

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
A

two-way data binding using ngModel

27
Q

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.
A

Provide a location where routed components will appear in the view.

28
Q

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.
A

Provide a link to a route.

29
Q

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.
A

An asynchronous stream of data which can be subscribed to.

30
Q

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.
A

Is delivered to all subscribers.

31
Q

Services must be registered in the module file in the

declarations section

imports section

providers section

bootstrap section
A

providers section

32
Q

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.
A

Including it as a private parameter in the constructor method.