JavaScript

Practice JavaScript MCQs covering variables, data types, operators, functions, objects, arrays, DOM manipulation, events, ES6+, asynchronous programming, APIs, and modern JavaScript concepts.

3
Topics
304
Total MCQs

JavaScript

Practice JavaScript MCQs covering variables, data types, operators, functions, objects, arrays, DOM manipulation, events, ES6+, asynchronous programming, APIs, and modern JavaScript concepts.

105 MCQs Page 2 of 6
0
0
/ 105
0%
A. ^
B. **
C. Math.pow()
D. Both b and c
Answer: Both ** operator and Math.pow() can be used for exponentiation.
A. true
B. false
C. undefined
D. TypeError
Answer: NaN is not equal to NaN, even itself. Use isNaN() to check.
A. setTimeout()
B. setInterval()
C. setDelay()
D. Both a and b
Answer: setTimeout() executes a function once after a delay, while setInterval() repeats it.
A. true
B. false
C. undefined
D. NaN
Answer: 3 < 2 is false (0), then 0 < 1 is true. The expression is evaluated left to right.
B. ''
C. null
D. All of the above
Answer: Falsy values include false, 0, '', null, undefined, NaN.
A. Creates a new array with the results of calling a function on every element
B. Modifies the original array
C. Filters elements based on a condition
D. Reduces an array to a single value
Answer: map() creates a new array by applying a function to each element.
A. true
B. false
C. undefined
D. TypeError
Answer: Due to type coercion, [] == ![] evaluates to true.
A. break
B. continue
C. return
D. exit
Answer: break is used to exit a loop entirely. continue skips the current iteration.
A. number
B. NaN
C. undefined
D. object
Answer: NaN is of type 'number', even though it represents 'Not a Number'.
A. concat()
B. join()
C. toString()
D. Both b and c
Answer: join() and toString() both convert arrays to strings, but join() allows custom separators.
A. true
B. false
C. undefined
D. NaN
Answer: 10 > 9 is true (1), then 1 > 8 is false.
A. window
B. document
C. global
D. console
Answer: window is the global object in browsers, containing document and other properties.
A. Creates a new array with elements that pass a test
B. Filters out elements and modifies the original array
C. Maps elements to new values
D. Reduces array to a single value
Answer: filter() creates a new array with elements that satisfy a provided condition.
A. 6
B. 4
C. 51
D. NaN
Answer: Both strings are coerced to numbers, and 5 - (-1) = 6.
A. try
B. catch
C. throw
D. All of the above
Answer: try, catch, and throw are all used in exception handling.
A. true
B. false
C. undefined
D. NaN
Answer: 1 < 2 is true (1), then 1 < 3 is true.
A. pop()
B. shift()
C. unshift()
D. slice()
Answer: shift() removes and returns the first element of an array.
A. 6
B. 8
C. 9
D. 16
Answer: The exponentiation operator ** computes 2 to the power of 3, which is 8.
A. push()
B. unshift()
C. shift()
D. concat()
Answer: unshift() adds elements to the beginning of an array.
A. true
B. false
C. undefined
D. TypeError
Answer: undefined and null are loosely equal (==) but not strictly equal (===).
1 2 3 4