94). What is the observation made in the following JavaScript code?
var count = [1,,3];

[A]The omitted value takes “undefined”
[B] This results in an error
[C]This results in an exception
[D]The omitted value takes an integer value

Show Answer

95). What will be the output of the following JavaScript code?
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

Show Answer

96). The pop() method of the array does which of the following task?The pop() method of the array does which of the following task?
var a1 = [,,,]; 
var a2 = new Array(3); 
0 in a1 
0 in a2

[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] updates the element

Show Answer

97). What is the observation made in the following JavaScript code?
if (!a[i]) continue;

[A]Skips the defined elements
[B]Skips the existent elements
[C]Skips the null elements
[D]Skips the defined & existent elements

Show Answer

98). What will happen if reverse() and join() methods are used simultaneously?
if (!a[i]) continue;

[A] Reverses and stores in the same array
[B]Reverses and concatenates the elements of the array
[C]Reverses
[D]Stores the elements of an array in normal order

Show Answer

99). What will be the possible output of the following JavaScript code?
var a = [1,2,3,4,5];
a.slice(0,3);

[A]Returns [1,2,3]
[B]Returns [4,5]
[C] Returns [1,2,3,4]
[D]Returns [1,2,3,4,5]

Show Answer

100). What will be the shift() output of the following JavaScript code?
var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift();
a.shift();
var output = a.shift();
document.writeln(output);

[A]1
[B] [4,5]
[C][3,4,5]
[D]Exception is thrown

Show Answer

101). The primary purpose of the array map() function is that it __________
var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift();
a.shift();
var output = a.shift();
document.writeln(output);

[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]pass the elements of the array into another array

Show Answer

102). The reduce and reduceRight methods follow a common operation called __________
var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift();
a.shift();
var output = a.shift();
document.writeln(output);

[A]filter and fold
[B]inject and fold
[C]finger and fold
[D]fold

Show Answer

103). The method or operator used to identify the array is __________
var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift();
a.shift();
var output = a.shift();
document.writeln(output);

[A] isarrayType()
[B]==
[C]===
[D]typeof

Show Answer

104). What will be the output of the following JavaScript code?
var val1=[1,2,3];  
var val2=[6,7,8];  
var result=val1.concat(val2);  
document.writeln(result);

[A] 1, 2, 3
[B]Error
[C]1, 2, 3, 6, 7, 8
[D]123

Show Answer

105). What will be the output of the following JavaScript code?
var values=[1,2,3,4]  
var ans=values.slice(1);  
document.writeln(ans);

[A] 1, 2, 3, 4
[B]2, 3, 4
[C] 1, 3, 4
[D]error

Show Answer

107). What will be the output of the following JavaScript code?
int sum=0;
 
var arr = [10,15,20,30];  
 
arr.forEach(function myFunction(element) 
{  
    	sum= sum+element;  
});  
document.writeln(sum);

[A]70
[B]75
[C]10
[D]error

Show Answer

108). What will be the output of the following JavaScript code?
var values=["one","two","Three"];  
var ans=values.shift();  
document.writeln(ans);

[A]one
[B]two
[C]two
[D]error

Show Answer

109). What will be the output of the following JavaScript code?
var arr=[1,2,3];  
var rev=arr.reverse();  
document.writeln(rev);

[A]1, 2, 3
[B]3, 2, 1
[C]3
[D]1

Show Answer