Angular Flashcards

1
Q

npm uses the package.json to manage what dependencies our application has.

A

true

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

By default, event handlers are set to the bubbling phase.

A

true

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

This function of the XMLHttpRequest object sends the request to the server?

A

send

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

This object is used to make Ajax calls.

A

XMLHttpRequest

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

Which will submit a form using JavaScript?

A

document.getElementById(‘myform’).submit( )

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

What is === operator?

A

Compares value equality as well as data type

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

How can you add new DIV elements dynamically?

A

document.createElement(‘div’)

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

Which is not a JavaScript data type?

A

Undeclared

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

What is the correct JavaScript syntax to change the content of the HTML element?

A

document.getElementById(“demo”).innerHTML = “Hello World!”;

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

The HTML DOM is an object based interface that allows JavaScript and other entities manipulate and create HTML elements dynamically.

A

true

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

You are allowed to have more than one script tag on the page for multiple JavaScript references.

A

true

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

Which method is best to use if you want to grab all paragraphs on the page?

A

getElementsByTagName()

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

The number -1000, is considered truthy

A

TRUE

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

Angular 2 supports TypeScript.

A

TypeScript is one of the main drivers behind Angular 2 because of the support for constructs such as Decorators.

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

True or False. The AppComponent is typically the name for an Angular 2 application’s root component.

A

The AppComponent is the Component defined in app-component.ts and serves as the main component of the application.

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

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

A

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
17
Q

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

A

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
18
Q

Data-binding is: (Choose the best option to complete this sentence)

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
19
Q

Directives are: (Choose the option that best completes this sentence)

A

elements, attributes and CSS style classes that you bind on your HTML templates

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

True or False. A Component is a specialized Directive.

A

true

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

A template is a collection of data values you pass to a component.

A

false

22
Q

Services are: (Choose the best option to complete this sentence)

A

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

23
Q

Interpolation is: (Choose the best option to complete the sentence)

A

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

24
Q
@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]?
A

{{ name }}

25
Q

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

A

@NgModule

26
Q

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

A

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

27
Q

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

A

Correct. components, directives and pipes are to be specified as values of the declarations property. services are specified in the providers array and other modules are specified as values for the imports property

28
Q

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

A

other modules

29
Q

Angular will match the selector property of the root component to an element in index.html during the bootstrapping process

A

TRUE

30
Q

True or False. If you want to set the value of a property that is NOT a string datatype, then you can use interpolation.

A

Correct. Interpolation is used only for string-based values. Use property-binding for other datatypes.

31
Q

Which of the following correctly uses property binding:

A

<img></img>

32
Q

Event-binding associates DOM events to component functions.

A

TRUE

33
Q

@Directive is used for creating custom directives.

A

TRUE

34
Q

True of False. ngModel, ngClass, and ngStyle are examples of structural directives.

A

FALSE

35
Q

True or False. ngIf does NOT remove the element from the DOM if the expression evaluates to false.

A

FALSE

36
Q

True or False. ngClass is used to add/remove multiple styles using key/value pairs of CSS

A

FALSE

37
Q

You cannot use a service within another.

A

FALSE

38
Q

Which of the following best describes what a Route is?

A

a path and an associated component

39
Q

Which of the following snippets correctly defines a Routes object that associates /path to PageComponent? (Choose the best option)

A

const routes: Routes = [
{path: ‘path’, component: PageComponent}
];

40
Q

Which method do you call to configure the routes in your application with the module?

A

RouterModule.forRoot(routes)

41
Q

Which directive is used to specify the location of routable content to display?

A

RouterOutlet

42
Q

A routerLink can be used to navigate to external URLs or websites outside of the current application.

A

FALSE

43
Q

A component is an important feature in Angular 2.

A

Explanation : You’ll find that many constructs in Angular 2 are referred to as Components. There is a special decorator that you’ll have to use, @Component, even when creating a component.

44
Q

Metadata is: (Choose the best option to complete the sentence)

A

a collection of data values that you pass to a component

45
Q

Modules are used to organize code in features or related functionality in order to prevent code bloat and promote code reuse.

A

TRUE

46
Q

A Logging Service is a type of feature that may be injected into another class.

A

TRUE

47
Q

The root module must be named AppModule.

A

FALSE

48
Q

Two-way Data-binding is like property-binding and event-binding together

A

TRUE

49
Q

Bootstrapping is the process during which your Root Component is inserted into the DOM.

A

TRUE

50
Q

myDiv

Given the following snippet:
<h1>Hello {{name}}</h1>
<div>This is a sentence</div>
<p>{{myDiv.innerHTML}}</p>
and 
@Component({
  moduleId: module.id,
  selector: 'my-app',
  templateUrl: './app.component.html'
})
export class AppComponent  { name = 'test'; }

name
myDiv.innerHTML
{{name}}

A

myDiv