1.
Consider the code snippet given below:

var count = [1,,3];
What is the observation made?

The omitted value takes "undefined"

This results in an error

This results in an exception

None of the mentioned

2.
Consider the following code snippet. The result would be
namespace McqsMentorConsoleApplication
var a1 = [,,,]; 
var a2 = new Array(3); 
0 in a1 
0 in a2

True false

False true

True true

False true

3.
The pop() method of the array does which of the following task ?

Decrements the total length by 1

Increments the total length by 1

Prints the first element but no effect on the length

None of the mentioned

4.
Consider the following code snippet :

if (!a[i]) continue ;
What is the observation made ?

Skips the undefined elements

Skips the non existent elements

Skips the null elements

All of the mentioned

5.
What will happen if reverse() and join() methods are used simultaneously ?

Reverses and stores in the same array

Reverses and concatenates the elements of the array

Reverses

All of the mentioned

6.
Consider the following code snippet :

var a = [1,2,3,4,5];
a.slice(0,3);
What is the possible output for the above code snippet ?

Returns [1,2,3]

Returns [4,5]

Returns [1,2,3,4]

Returns [1,2,3,4,5]

7.
Consider the following code snippet. The final output for the shift() is
namespace McqsMentorConsoleApplication
var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift(); 
a.shift();
a.shift();

1

[4,5]

[3,4,5]

Exception is thrown

8.
The primary purpose of the array map() function is that it

Maps the elements of another array into itself

Passes each element of the array and returns the necessary mapped elements

Passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function

None of the mentioned

11.
The function definitions in JavaScript begins with

Identifier and Parantheses

Return type and Identifier

Return type, Function keyword, Identifier and Parantheses

Identifier and Return type

12.
Consider the following code snippet. What will the code snippet result ?
namespace McqsMentorConsoleApplication
function printprops(o) 
{
  for(var p in o)
  console.log(p + ": " + o[p] + "n");
}

Prints the contents of each property of o

Returns undefined

All of the mentioned

None of the mentioned

13.
When does the function name become optional in JavaScript?

When the function is defined as a looping statement

When the function is defined as expressions

When the function is predefined

All of the mentioned

14.
What is the purpose of a return statement in a function?

Returns the value and continues executing rest of the statements, if any

Returns the value and stops the program

Returns the value and stops executing the function

Stops executing the function and returns the value

15.
What will happen if a return statement does not have an associated expression?

It returns the value 0

It will throw an exception

It returns the undefined value

None of the mentioned

0Shares
0
Scroll to Top