Arrays in JavaScript are high-level, list-like objects used to store ordered collections of elements of varying data types. Zero-indexed and dynamically resizable, JavaScript arrays come with built-in prototype methods for adding (push, unshift), removing (pop, shift), transforming (map, filter, reduce), and reorganizing (sort, reverse, splice) data. Modern ECMAScript standards (ES6+) introduced features such as array destructuring, the spread operator (...), and non-mutating array copy methods (toSorted, toSpliced, toReversed, with). Understanding how array mutation works, how sparse arrays behave, and how iterative callbacks operate is vital for clean web development and technical coding assessments.
JavaScript Arrays MCQs for Developer Interviews & Certification
1 min read
Correct Answer: a) true
Explanation:
Array.isArray() is the standard method to verify if a given value is an instance of Array.
Correct Answer: b) pop()
Explanation:
The pop() method mutates the array by removing its final element and returning that removed element.
Correct Answer: a) push()
Explanation:
The push() method appends new elements to the end of an array and returns the array's updated length.
Correct Answer: b) shift()
Explanation:
The shift() method removes the element at index 0, shifts all remaining elements down, and returns the removed element.
Correct Answer: a) unshift()
Explanation:
The unshift() method inserts new elements at index 0 of an array and returns the new length.
Correct Answer: a) 1
Explanation:
indexOf() returns the first index at which a given element can be found in the array.
Correct Answer: a) -1
Explanation:
When an element is not present in the target array, indexOf() returns -1.
Correct Answer: b) map()
Explanation:
map() transforms each element of an array using a callback function and returns a new array of the same length.
Correct Answer: b) filter()
Explanation:
filter() creates a new array containing only elements that evaluate to true in the provided testing callback.
Correct Answer: c) undefined
Explanation:
forEach() executes a provided function once for each array element and always returns undefined.
Correct Answer: a) [2, 3]
Explanation:
slice(start, end) extracts elements from start index up to, but not including, the end index.
Correct Answer: b) No
Explanation:
slice() is a non-mutating method that returns a shallow copy of the selected portion of the array.
Correct Answer: a) Yes
Explanation:
splice() modifies the content of an array in place by removing, replacing, or adding elements.
Correct Answer: a) [3, 4]
Explanation:
splice(start, deleteCount) returns an array containing the elements that were removed from index 2.
Correct Answer: a) true
Explanation:
includes() determines whether an array includes a certain value among its entries, returning true or false.
Correct Answer: a) includes() finds NaN, whereas indexOf() returns -1.
Explanation:
includes() uses the SameValueZero comparison algorithm which handles NaN, whereas indexOf uses strict equality (===).
Correct Answer: a) 20
Explanation:
find() returns the value of the first element in the array that satisfies the provided testing function.
Correct Answer: a) 1
Explanation:
findIndex() returns the index of the first element in the array that satisfies the testing function.
Correct Answer: a) undefined
Explanation:
If no elements pass the search condition, find() returns undefined.
Correct Answer: a) -1
Explanation:
If no elements pass the testing condition, findIndex() returns -1.
Correct Answer: a) [1, 2, 3, 4, 5]
Explanation:
concat() merges two or more arrays and returns a new combined array.
Correct Answer: a) 1-2-3
Explanation:
join() creates and returns a new string by concatenating all array elements separated by the specified string.
Correct Answer: a) ,
Explanation:
If no separator argument is supplied to join(), it defaults to separating items with a comma.
Correct Answer: a) 10
Explanation:
reduce() executes a reducer callback on each element, summing 0 + 1 + 2 + 3 + 4 to result in 10.
Correct Answer: a) TypeError
Explanation:
Executing reduce() on an empty array with no initial value throws a TypeError.
Correct Answer: a) true
Explanation:
every() tests whether all elements in the array pass the provided condition.
Correct Answer: a) true
Explanation:
some() tests whether at least one element in the array passes the testing function.
Correct Answer: a) true
Explanation:
every() returns true for any condition when called on an empty array (vacuous truth).
Correct Answer: a) false
Explanation:
some() returns false for any condition when called on an empty array.
Correct Answer: a) ["c", "a", "t"]
Explanation:
Array.from() creates a new array instance from an iterable object such as a string.
Correct Answer: a) [7]
Explanation:
Array.of(7) creates a new Array instance with a single element [7], regardless of type or quantity of arguments.
Correct Answer: a) Array.of(3) creates [3]; new Array(3) creates an array with 3 empty slots.
Explanation:
Passing a single number to new Array(N) sets the length to N with empty slots, while Array.of(N) creates [N].
Correct Answer: a) [1, 2, [3]]
Explanation:
The flat() method flattens sub-array structures up to a default depth of 1.
Correct Answer: a) arr.flat(Infinity)
Explanation:
Passing Infinity as the depth parameter to flat() recursively flattens all nested arrays.
Correct Answer: a) [1, 2, 2, 4, 3, 6]
Explanation:
flatMap() first maps each element using a mapping function, then flattens the result by depth 1.
Correct Answer: a) String Unicode code point order
Explanation:
By default, sort() converts elements to strings and compares their UTF-16 code units.
Correct Answer: a) [1, 10, 2, 21]
Explanation:
Default string sorting places '10' before '2' because character '1' comes before '2'.
Correct Answer: a) arr.sort((a, b) => a - b)
Explanation:
The comparator function (a, b) => a - b returns a negative value if a < b, ordering numbers numerically.
Correct Answer: a) Yes
Explanation:
sort() modifies the original array in place and returns a reference to the same array.
Correct Answer: a) toSorted()
Explanation:
toSorted() was introduced in ES2023 as a non-mutating version of sort().
Correct Answer: a) toReversed()
Explanation:
toReversed() returns a new array with elements in reversed order without changing the original array.
Correct Answer: a) with()
Explanation:
The with(index, value) method returns a copy of the array with the element at the specified index replaced.
Correct Answer: a) 30
Explanation:
The at() method supports negative integers to count back from the end of the array (-1 is the last item).
Correct Answer: a) undefined
Explanation:
Standard bracket notation does not support negative indices and attempts to look up property key '-1'.
Correct Answer: a) [1, 0, 0]
Explanation:
fill(value, start, end) changes array elements to a static value from start index up to end index.
Correct Answer: a) [4, 5, 3, 4, 5]
Explanation:
copyWithin(target, start) copies array elements from start index to target position in place.
Correct Answer: a) [0, 1, 2]
Explanation:
keys() returns an Array Iterator containing the indices (0, 1, 2) of the array.
Correct Answer: a) [10, 20]
Explanation:
values() returns an Array Iterator containing the values of the array.
Correct Answer: a) [[0, 10], [1, 20]]
Explanation:
entries() returns an iterator yielding key/value pairs [index, element] for each item.
Correct Answer: a) The array is truncated in place, removing trailing items.
Explanation:
Truncating the length property removes all elements whose indices are greater than or equal to the new length.
Correct Answer: a) The array is completely emptied.
Explanation:
Setting length to 0 deletes all elements in the array in place.
Correct Answer: a) RangeError
Explanation:
Assigning an invalid, negative, or non-integer length value throws a RangeError.
Correct Answer: a) An array with unassigned indices (empty slots or holes)
Explanation:
A sparse array is one in which elements are non-contiguous and length exceeds element count.
Correct Answer: a) It skips unassigned empty slots entirely.
Explanation:
Built-in array iteration methods like forEach, map, and filter skip empty slots in sparse arrays.
Correct Answer: a) It iterates over empty slots yielding undefined.
Explanation:
The for...of loop uses the array iterator, which treats empty slots as having the value undefined.
Correct Answer: a) Index 1 is deleted leaving an empty slot; length remains 3.
Explanation:
The delete operator removes the property at index 1 without re-indexing remaining items or changing array length.
Correct Answer: a) false
Explanation:
Arrays are object reference types in JavaScript. Comparing distinct array references evaluates to false.
Correct Answer: a) false
Explanation:
Two distinct array instances occupy different memory addresses, making reference comparison false.
Correct Answer: d) All of the above
Explanation:
Spread operator, slice(), and Array.from() are all standard methods to create a shallow copy of an array.
Correct Answer: a) structuredClone()
Explanation:
structuredClone() is a standard built-in global function that creates deep copies of JavaScript values and data structures.
Correct Answer: a) ["h", "e", "l", "l", "o"]
Explanation:
Applying the spread operator to a string spreads its individual characters into array elements.
Correct Answer: a) 1
Explanation:
lastIndexOf() searches the array backwards and returns the last index at which a value is found.
Correct Answer: a) 3
Explanation:
The last occurrence of value 2 in [1, 2, 3, 2, 1] is located at index position 3.
Correct Answer: a) "321"
Explanation:
reduceRight() processes elements from right to left, concatenating '3' + '2' + '1' into '321'.
Correct Answer: a) Array.isArray() returns true only for standard Array instances.
Explanation:
Array.isArray() explicitly evaluates to false for TypedArray instances (e.g., Int8Array).
Correct Answer: a) 20
Explanation:
findLast() searches backwards from the end and returns the first element that satisfies the condition (20).
Correct Answer: a) 1
Explanation:
findLastIndex() searches backwards and returns the index of the first matching element (index 1 for value 20).
Correct Answer: a) undefined
Explanation:
Accessing a non-existent property/index on an array returns undefined.
Correct Answer: a) 5
Explanation:
Setting element at index 4 automatically updates the array length property to index + 1 = 5.
Correct Answer: a) [1, NaN, NaN]
Explanation:
map passes (element, index) to parseInt. parseInt(1, 0) is 1; parseInt(2, 1) is NaN; parseInt(3, 2) is NaN.
Correct Answer: c) Both a and b
Explanation:
Passing Number or explicit arrow wrapper `x => parseInt(x, 10)` avoids index parameters being passed as radix.
Correct Answer: a) TypeError: Cannot add property, object is not extensible
Explanation:
Object.freeze() prevents adding, deleting, or modifying array elements. Calling mutating methods throws a TypeError.
Correct Answer: a) "1,2,3"
Explanation:
Array.prototype.toString joins elements with commas, returning '1,2,3'.
Correct Answer: a) "[object Array]"
Explanation:
Object.prototype.toString returns the internal [[Class]] tag string '[object Array]'.
Correct Answer: a) 3
Explanation:
unshift() called without arguments leaves the array unchanged and returns its current length (3).
Correct Answer: a) 3
Explanation:
push() called without arguments returns the current length of the array (3).
Correct Answer: a) concat()
Explanation:
concat() combines two or more arrays without altering existing arrays.
Correct Answer: a) []
Explanation:
filter() skips unassigned empty slots in sparse arrays, so callback is never invoked for empty holes.
Correct Answer: a) false
Explanation:
Trailing comma syntax creates empty slots. Empty slots do not exist as properties, returning false.
Correct Answer: a) [2, 3]
Explanation:
When end index is omitted, slice extracts from start index to the end of the array.
Correct Answer: a) []
Explanation:
If start index is greater than or equal to array length, slice() returns an empty array.
Correct Answer: a) [2, 3]
Explanation:
When deleteCount is omitted in splice(), all elements from start index to array end are removed and returned.
Correct Answer: a) [1, 99, 2, 3]
Explanation:
Setting deleteCount to 0 in splice inserts elements at start index without removing existing items.
Correct Answer: a) [1, 1, 1]
Explanation:
Array(3) creates an array of length 3 with empty slots, and fill(1) populates all slots with value 1.
Correct Answer: a) Each slot receives a reference to the exact same object.
Explanation:
fill() populates the array with the exact reference passed, so modifying one item affects all slots.
Correct Answer: a) None of the standard Array prototype iteration methods are inherently asynchronous.
Explanation:
All standard Array methods (forEach, map, filter, etc.) run synchronously.
Correct Answer: a) An array of unresolved Promises [Promise, Promise, Promise]
Explanation:
Async functions always return Promises, so map() returns an array containing Promise objects.
Correct Answer: a) Promise.all(arr.map(asyncFn))
Explanation:
Promise.all() accepts an array of Promises and returns a single Promise that resolves when all resolve.
Correct Answer: a) true
Explanation:
every() on an empty array returns true regardless of callback.
Correct Answer: a) false
Explanation:
some() on an empty array returns false regardless of callback.
Correct Answer: a) true
Explanation:
Array.prototype lies directly in the prototype chain of literal arrays [].
Correct Answer: a) [3, 2, 1]
Explanation:
reverse() inverts the array elements in place and returns the mutated array.
Correct Answer: a) [1, 2]
Explanation:
reverse() returns a reference to the same original array object `a`. Mutating `b` mutates `a`.
Correct Answer: a) "1,2,3"
Explanation:
Array.prototype.toString converts array elements to strings and joins them with commas.
Correct Answer: a) "1,2,3"
Explanation:
toString on arrays recursively calls toString on nested arrays, flattening them into '1,2,3'.
Correct Answer: a) includes()
Explanation:
includes() checks for presence using SameValueZero (similar to strict equality, but handles NaN).
Correct Answer: a) undefined
Explanation:
Accessing an out-of-bounds index using at() returns undefined.
Correct Answer: a) 1
Explanation:
Index -3 counts 3 positions back from array length 3, targeting index 0 (value 1).
Correct Answer: d) All of the above
Explanation:
Array.from, slice.call, and spread (for iterables) are valid conversion techniques.
Correct Answer: a) -1
Explanation:
findIndex returns -1 when no element matches the condition.
Correct Answer: a) undefined
Explanation:
find returns undefined when no element satisfies the test function.
Related Posts

C++ Strings MCQs
In C++, strings are handled in two primary ways: traditional C-style strings (null-terminated character arrays) and the modern std::string class…
October 20, 2026By MCQs Generator

Important Java 8 Features MCQs
Released in March 2014, Java 8 represents one of the most significant upgrades in the history of the Java programming…
October 19, 2026By MCQs Generator

C++ OOP MCQs Object-Oriented Programming
Object-Oriented Programming (OOP) in C++ revolutionizes software design by organizing code around data (objects) rather than relying solely on functions…
October 20, 2026By MCQs Generator
Related Categories

AI & Data Science MCQ
5 topics
By MCQs Generator

Arts & Humanities MCQ
4 topics
By MCQs Generator

Civil Engineering MCQ
4 topics
By MCQs Generator

Commerce & Business MCQ
4 topics
By MCQs Generator

Competitive Exams MCQ
5 topics
By MCQs Generator

Electrical & Electronics Engineering MCQ
3 topics
By MCQs Generator

General Knowledge MCQ
2 topics
By MCQs Generator

General Science MCQ
4 topics
By MCQs Generator

Law & Judiciary MCQ
3 topics
By MCQs Generator

Mechanical Engineering MCQ
4 topics
By MCQs Generator

Medical & Health Sciences MCQ
4 topics
By MCQs Generator

Modern Tech Fields MCQ
3 topics
By MCQs Generator