LearnFrenzy
Sign in Take a free test

Operators · Exercise 1 of 4

Operators JavaScript Operators MCQ

  • 15 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Fifteen multiple-choice questions on JavaScript operators: == and ===, increments, && and || return values, ?? and ?., exponent associativity, in, instanceof, delete and Object.is. Pick an option to check your answer instantly.

Question 11 Hard

What happens with const v = a || b ?? "default";?

A It is evaluated as (a || b) ?? "default"
B It is evaluated as a || (b ?? "default")
C SyntaxError: ?? cannot be combined with || or && without parentheses
D It always returns "default"
Question page & discussion
Question 12 Easy

What does the unary + do in +"42"?

A Makes the number positive only if it is negative
B Converts the operand to a number (42)
C Concatenates it with an empty string
D Nothing; it is a SyntaxError
Question page & discussion
Question 13 Hard

What does delete arr[1] do to const arr = [10, 20, 30];?

A Removes the element and shifts the rest – the length becomes 2
B Sets arr[1] to null
C Throws a TypeError because arr is const
D Removes the element but leaves a hole – the length stays 3
Question page & discussion
Question 14 Medium

What does obj instanceof Car actually check?

A Whether Car.prototype appears anywhere in obj's prototype chain
B Whether obj was created with a variable named Car
C Whether typeof obj === "Car"
D Whether obj has the same properties as Car
Question page & discussion
Question 15 Hard

For which pair of values do Object.is(a, b) and a === b give different results?

A 1 and "1"
B NaN and NaN
C null and undefined
D "a" and "a"
Question page & discussion
Up next · Exercise 2Predict the Output20 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links