This Quiz contains totally 10 Questions each carry 1 point for you.
1. The method or operator used to identify the array is
isarrayType()
==
===
type of
Correct!
Wrong!
2. 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 as array containing the values returned by that function
none of the mentioned
Correct!
Wrong!
3. What is the observation made in the following JavaScript code?
var count = [1,,3];
var count = [1,,3];
The omitted value takes “undefined”
This results in an error
This results in an exception
The omitted value takes an integer value
Correct!
Wrong!
4. 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);
int sum=0;
var arr = [10,15,20,30];
arr.forEach(function myFunction(element)
{
sum= sum+element;
});
document.writeln(sum);
70
75
10
error
Correct!
Wrong!
5. What is the value of passed in the following code?
var marks = [30, 35, 42, 20, 15];
var passed = marks.every(function(m) {
return m > 40;
});
var marks = [30, 35, 42, 20, 15];
var passed = marks.every(function(m) {
return m > 40;
});
true
false
42
NONE
Correct!
Wrong!
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:
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]
Correct!
Wrong!
7. 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
updates the element
Correct!
Wrong!
8. How to access the second element of the array arr = [3, 7, 10]?
arr.indexOf(2)
arr.indexOf(1)
arr[2]
arr[1]
Correct!
Wrong!
9. How to replace the second element in the array arr = [1, 7, 9] with the value 8?
arr[1] = 8
arr[2] = 8
arr.indexOf(1) = 8
None
Correct!
Wrong!
10. What will the following code log?
var arr = [1, 66, 20];
arr.length = 0;
console.log(arr[0]);
var arr = [1, 66, 20];
arr.length = 0;
console.log(arr[0]);
0
1
undefined
It throws an error
Correct!
Wrong!
Share the quiz to show your results !
Subscribe to see your results
Ignore & go to results
Javascript – Arrays – Quiz
You got %%score%% of %%total%% right
%%description%%
%%description%%
Loading...