A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

1. Consider the code snippet given below:

var count = [1,,3];

What is the observation made?
a. The omitted value takes "undefined"
b. This results in an error
c. This results in an exception
d. None of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (a).The omitted value takes "undefined"

2. Consider the following code snippet. The result would be
var a1 = [,,,]; 
var a2 = new Array(3); 
0 in a1 
0 in a2
a. true false
b. false true
c. true true
d. false true
View Answer Report Discuss Too Difficult!
Answer: (a).true false

3. The pop() method of the array does which of the following task ?
a. decrements the total length by 1
b. increments the total length by 1
c. prints the first element but no effect on the length
d. None of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (a).decrements the total length by 1

4. Consider the following code snippet :

if (!a[i]) continue ;

What is the observation made ?
a. Skips the undefined elements
b. Skips the non existent elements
c. Skips the null elements
d. All of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (d).All of the mentioned

5. What will happen if reverse() and join() methods are used simultaneously ?
a. Reverses and stores in the same array
b. Reverses and concatenates the elements of the array
c. Reverses
d. All of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (a).Reverses and stores in the same array

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 ?
a. Returns [1,2,3]
b. Returns [4,5]
c. Returns [1,2,3,4]
d. Returns [1,2,3,4,5]
View Answer Report Discuss Too Difficult!
Answer: (a).Returns [1,2,3]

7. Consider the following code snippet. The final output for the shift() is
var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift(); 
a.shift();
a.shift();
a. 1
b. [4,5]
c. [3,4,5]
d. Exception is thrown
View Answer Report Discuss Too Difficult!
Answer: (a).1

8. The primary purpose of the array map() function is that it
a. maps the elements of another array into itself
b. passes each element of the array and returns the necessary mapped elements
c. 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
d. None of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (c).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

9. The reduce and reduceRight methods follow a common operation called
a. filter and fold
b. inject and fold
c. finger and fold
d. fold
View Answer Report Discuss Too Difficult!
Answer: (b).inject and fold

10. The method or operator used to identify the array is
a. isarrayType()
b. ==
c. ===
d. typeof
View Answer Report Discuss Too Difficult!
Answer: (d).typeof

Page 1 of 4