ExamVeda
Login
Home
1
Consider the code snippet given below
var count = [1,,3];
What is the observation made?
Discuss
Answer & Solution
Answer: Option A
Solution:
If you omit a value from an array literal, the omitted element is given the value.
2
Consider the following code snippet
var a1 = [,,,]; 
var a2 = new Array(3); 
0 in a1 
0 in a2
The result would be
Discuss
Answer & Solution
Answer: Option A
Solution:
a1 has an element with index 0 and a2 has no element with index 0.
3
The pop() method of the array does which of the following task ?
Discuss
Answer & Solution
Answer: Option A
Solution:
Arrays have a pop() method (it works with push()) that reduces the length of an array by 1 but also returns the value of the deleted element.
4
Consider the following code snippet :
if (!a[i]) continue ;
What is the observation made ?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
5
What will happen if reverse() and join() methods are used simultaneously ?
Discuss
Answer & Solution
Answer: Option A
Solution:
The reverse() followed by a join() will reverse the respective array and will store the reversed array in the memory.
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 ?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
7
Consider the following code snippet :
var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift(); 
a.shift();
a.shift();
The final output for the shift() is
Discuss
Answer & Solution
Answer: Option A
Solution:
The unshift() and shift() methods behave much like push() and pop(), except that they insert and remove elements from the beginning of an array rather than from the end. unshift() adds an element or elements to the beginning of the array, shifts the existing array elements up to higher indexes to make room, and returns the new length of the array. shift() removes and returns the first element of the array, shifting all subsequent elements down one place to occupy the newly vacant space at the start of the array.
8
The primary purpose of the array map() function is that it
Discuss
Answer & Solution
Answer: Option C
Solution:
The map() method passes each element of the array on which it is invoked to the functionyou specify, and returns an array containing the values returned by that function.
9
The reduce and reduceRight methods follow a common operation called
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
10
The method or operator used to identify the array is
Discuss
Answer & Solution
Answer: Option D
Solution:
The typeof property is used to identify the array type.