JavaScript_Objects_quiz_md - brainchildservices/curriculum GitHub Wiki

  1. Which of these is a valid line of JS code that stores an object in a variable?

    A. var me = {age=31, hair='brown'};

    B. var me = {age: 31, hair: 'brown'};

    C. var me = {var age=31, var hair='brown'};

    Ans: B

  2. A JavaScript object is a collection of -------

    Ans. Named Values

  3. Which of the following is the literal way to create an object with a property x of value 10?

    A. {x: 10}

    B. new Object({x: 10})

    C. both a & b

    D. none

    Ans:A

  4. Objects can contain objects as property values. True or false?

    A.TRUE

    B. FALSE

    C. NONE

    Ans: A

  5. An object is an un-ordered collection of ………………………, each of which has a name and a value.

    A) properties

    B) names

    C) values

    D) All of the above

    Ans: A

  6. The ……………………… attribute of an object specifies whether the value of the property can be set.

    A) readable

    B) writable

    C) enumerable

    D) configurable

    Ans:B

  7. The …………………….. attribute of an object specifies whether the property can be deleted and whether its attributes can be altered.

    A) readable

    B) writable

    C) enumerable

    D) configurable

    Ans : D

  8. An object’s ……………………….. is a reference to another object from which properties are inherited.

    A) Characteristics

    B) Prototype

    C) Class

    D) Extensible flag

    Ans: B

  9. An object’s …………………… is a string that categorizes the type of an object.

    A) Characteristics

    B) Prototype

    C) Class

    D) Extensible flag

    Ans: C

  10. An object’s ………………………. specifies whether new properties may be added to the object.

    A) Characteristics

    B) Prototype

    C) Class

    D) Extensible flag

    Ans : D

  11. A ……………………. object is any object created by the execution of JavaScript code.

    A) native

    B) host

    C) user-defined

    D) remote

    Ans: C

  12. JavaScript objects can be created with the new keyword, and with the ………………. function.

    A) object()

    B) object.create()

    C) JavaScript.object()

    D) create.object()

    Ans: B

  13. An ……………………… is a comma-separated list of colon separated name: value paris, enclosed within curly braces.

    A) object prototype

    B) object literal

    C) object class

    D) associative arrays

    Ans: B

  14. An ………………………. is an expression that creates and initializes a new and distinct object each time it is evaluated.

    A) object prototype

    B) object literal

    C) object class

    D) associative arrays

    Ans: B

  15. The …………………… returns true only if the named property is an own property and its enumerable attribute is true.

    A) hasOwnProperty()

    B) propertyIsEnumerable()

    C) getOwnProperty()

    D) IsPropertyOf()

    Ans:B

  16. Properties defined by getters and setters are sometimes known as …………….. to distinguish them from data properties that have a simple value.

    A) accessor properties

    B) getters properties

    C) setters properties

    D) getter and setters properties

    Ans: A

  17. The ………………….. attribute of property descriptor object governs attempts to change the other attributes and also specifies whether the property can be deleted.

A ) writable

B) configurable

C) enumerable

D) value

Ans: B
  1. If data property is not configurable, you can’t change its ……………………… attribute from false to true, but you can change it from true to false.

    A) writable

    B) configurable

    C) enumerable

    D) value

    Ans: A

  2. If an accessor property is not ………………………. you can’t change its getter or setter method and you can’t change it to a data property.

    A) writable

    B) configurable

    C) enumerable

    D) value

    Ans: B

  3. The constructor prototype refers to the correct prototype for ………………………… but does not usually do so for objects created with Object.Create( ).

    A) object prototype

    B) object literal

    C) object class

    D) associative arrays

    Ans:B

  4. An object’s …………………. attribute specifies the object from which it inherits properties.

    A) prototype

    B) class

    C) extensible

    D) literal

    Ans:A

  5. An object’s ………………….. attribute is a sting that provides information about the type of the object.

    A) prototype

    B) class

    C) extensible

    D) literal

    Ans:B

  6. The …………………………. attribute of an object specifies whether new properties can be added to the object or not.

    A) prototype

    B) class

    C) extensible

    D) literal

    Ans: C

  7. In order to make an object non extensible, you can pass it to ……………….

A) Object.preventExtensions()

B) Object.seal()

C) Object.lock()

D) Object.freeze()

Ans: A

  1. The purpose of ……………………… attribute is to be able to “lock down” objects into known state and prevent outside tempering.

    A) prototype

    B) class

    C) extensible

    D) literal

Ans: C

  1. …………………… works like object.preventExtensions(), but in addition to making the object nonextensible, it also makes all of the own properties of that object non-configurable.

A) Object.preventExtensions()

B) Object.seal()

C) Object.lock()

D) Object.freeze()

Ans:B

  1. Object ……………………….. is the process of converting an object’s state to a string from which it can later be restored.

A) prototype

B) class

C) extensible

D) serialization

Ans:D

  1. The type that specifies what kind of event occurred is

A. event type

B. even target

C. both event type and even target

D. none of the mentioned

Ans: A

  1. Which property specifies the property of the event?

A. Type

B. Target

C. Manner

D. All of the mentioned

  1. In general, event handler is nothing but

A.function

B.interface

C. event

D. handler