Object Test Flashcards

1
Q

A____ is a value that has no properties or methods.

A

primitive value

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

A____ is data that has a primitive value.

A

primitive data type

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

JavaScript defines 5 types of primitive data types:

A
string
number
boolean
null
undefined
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

True or false? Primitive values are immutable

A

True

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

True or false? if x = 3.14, you can change the value of x. But you cannot change the value of 3.14.

A

True

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

A JavaScript object is a collection of_____

A

named values

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

The values of an object are written as:

A

name : valuepairs

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

The named values, in JavaScript objects, are called____

A

properties

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

Methods are___ that can be performed on objects.

A

actions

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

Anobject methodis an object property containing a___

A

function definition.

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

JavaScript objects are containers for named values, called

A

properties and methods.

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

There are 3 different ways to create new objects:

A
  1. Define and create a single object, using an object literal.
  2. Define and create a single object, with the keyword new.
  3. Define an object constructor, and then create objects of the constructed type.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the easiest way to create a javascript object?

A

Define and create a single object, using an object literal.

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

How do you define and create a single object, using an object literal.

A

varperson = {firstName:”John”, lastName:”Doe”, age:50, eyeColor:”blue”};

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

How do you define and create a single object, with the keyword new.

A

varperson =newObject();

person. firstName=”John”;
person. lastName=”Doe”;
person. age=50;
person. eyeColor=”blue”;

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

Which of these will give you John Doe?

A. name = person.fullName();
B. name = person.fullName;

A

A

17
Q

Which of these will give you the function definition?

A. name = person.fullName();
B. name = person.fullName;

A

B

18
Q

True or false? Objects are immutable

A

False, they are mutable.