JavaScript Array MCQ Questions & Answer
Javascript (JS) Array MCQs : This section focuses on the "Javascript Array". These Multiple Choice Questions (MCQs) should be practiced to improve the Javascript skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. An _______ is a special variable, which can hold more than one value
A. string
B. integer
C. character
D. array
View Answer
Ans : D
Explanation: An array is a special variable, which can hold more than one value.
2. It is a common practice to declare arrays with the _________ keyword.
A. var
B. let
C. const
D. none of the above
View Answer
Ans : C
Explanation: It is a common practice to declare arrays with the const keyword.
3. Spaces and line breaks are not important.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Spaces and line breaks are not important.
4. Array indexes start with ______.
A. -1
B. 0
C. 1
D. Can not say
View Answer
Ans : B
Explanation: Array indexes start with 0. [0] is the first element. [1] is the second element.
5. The ________ operator in JavaScript returns "object" for arrays.
A. and
B. or
C. not
D. typeof
View Answer
Ans : D
Explanation: The typeof operator in JavaScript returns "object" for arrays.
6. What is true about Arrays?
A. JavaScript does not support associative arrays
B. You should use objects when you want the element names to be strings
C. You should use arrays when you want the element names to be numbers
D. All of the above
View Answer
Ans : D
Explanation: All of the above are true about Arrays.
7. The easiest way to add a new element to an array is using the _________ method
A. add()
B. insert()
C. push()
D. set()
View Answer
Ans : C
Explanation: The easiest way to add a new element to an array is using the push() method.
8. The _______ method also joins all array elements into a string.
A. toString()
B. join()
C. pop()
D. shift()
View Answer
Ans : B
Explanation: The join() method also joins all array elements into a string.
9. Array elements can be deleted using the JavaScript operator?
A. pop
B. shift
C. delete
D. All of the above
View Answer
Ans : D
Explanation: Array elements can be deleted using the JavaScript operator delete.Using delete leaves undefined holes in the array.Use pop() or shift() instead.
10. arrays always use numbered indexes.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, arrays always use numbered indexes.
Discussion