Contents

The unordered collection of properties, each of which has a name and a value is called ……
a) String                                
b) Object
c) Serialized Object            
d) Array

b

Explanation: Objects in JavaScript may be defined as an unordered collection of related data, of primitive or reference types, in the form of “key:value” pairs. Hence each of the property has a name and value.


The object has three object attributes namely…
a) Class, parameters, object’s extensible flag
b) Prototype, class, objects’ parameters
c) Prototype, class, object’s extensible flag
d) Native object, Classes and Interfaces and Object’s extensible flag

c

Explanation: Every object has three associated object attributes:
1. An object’s prototype is a reference to another object from which properties are inherited.
2. An object’s class is a string that categorizes the type of an object.
3. An object’s extensible flag specifies whether new properties may be added to the object.


The function definitions in JavaScript begins with……….
a) Identifier and Parentheses
b) Return type and Identifier
c) Return type, Function keyword, Identifier and Parentheses
d) Identifier and Return type

c

When does the function name become optional in JavaScript?
a) When the function is defined as a looping statement
b) When the function is defined as expressions
c) When the function is predefined
d) when the function is called

b

Explanation: The function name is optional for functions defined as expressions. A function declaration statement actually declares a variable and assigns a function object to it.


What is the purpose of a return statement in a function?
a) Returns the value and continues executing rest of the statements, if any
b) Returns the value and stops the program
c) Returns the value and stops executing the function
d) Stops executing the function and returns the value

d

Explanation: The return stops the execution of the function when it is encountered within the function. It returns the value to the statement where the function is called.


What will happen if a return statement does not have an associated expression?
a) It returns the value 0
b) It will throw an exception
c) It returns the undefined value
d) It will throw an error

c

Explanation: A function without a return statement will return a default value. If the return statement does not have an associated expression then it returns an undefined value.