JavaScript Operators MCQs

1 min read

JavaScript operators are foundational symbols and keywords used to manipulate data, perform mathematical computations, assign values, and control programmatic flow within web applications. They range from standard arithmetic and assignment operators to sophisticated logical, bitwise, and comparison constructs. Modern ECMAScript specifications (ES6+) expanded this toolkit with features like the nullish coalescing operator (??), optional chaining (?.), and logical assignment operators (||=, &&=, ??=), which allow for concise, null-safe data handling. Understanding operator precedence, type coercion behaviors (such as loose versus strict equality), and short-circuit evaluation is critical for writing predictable code and excelling in technical interviews.

1. Which operator converts a 32-bit floating-point number into a 32-bit signed integer by truncating its fractional part?

a) Bitwise OR with zero (| 0)
b) Logical NOT (!)
c) Unary plus (+)
d) Exponentiation (**)
Correct Answer: a) Bitwise OR with zero (| 0)
Explanation:
Bitwise operators in JavaScript convert their operands to 32-bit signed integers, so using '| 0' truncates the decimal part of a number.

2. What is the output of `console.log(~~-3.7)` in JavaScript?

a) -3
b) -4
c) 3
d) 4
Correct Answer: a) -3
Explanation:
The double bitwise NOT (~~) truncates fractional digits toward zero, converting -3.7 to -3.

3. What does the expression `x &&= y` evaluate to if `x` is initialised as `null`?

a) null
b) y
c) undefined
d) false
Correct Answer: a) null
Explanation:
Logical AND assignment (&&=) only assigns the right-hand value if the left-hand value is truthy. Since null is falsy, x remains null.

4. What is the output of `console.log(undefined ?? null ?? "Value")`?

a) Value
b) null
c) undefined
d) TypeError
Correct Answer: a) Value
Explanation:
The nullish coalescing operator (??) skips both undefined and null (both are nullish) and returns the first defined value, which is "Value".

5. What will `console.log(false ?? "Fallback")` evaluate to?

a) false
b) Fallback
c) undefined
d) true
Correct Answer: a) false
Explanation:
The nullish coalescing operator (??) checks strictly for null or undefined. Since false is neither, it returns false.

6. What is the result of `console.log(10 >>> 2)`?

a) 2
b) 40
c) 5
d) 0
Correct Answer: a) 2
Explanation:
Zero-fill right shift (>>>) shifts the binary digits of 10 (1010) right by 2 bits, yielding 2 (0010).

7. What is the result of `console.log(-10 >>> 2)`?

a) 1073741821
b) -2
c) -5
d) 0
Correct Answer: a) 1073741821
Explanation:
Zero-fill right shift (>>>) fills from the left with zeroes, turning a negative 32-bit two's complement integer into a large positive integer.

8. What is the output of `console.log("a" < "b")`?

a) true
b) false
c) NaN
d) TypeError
Correct Answer: a) true
Explanation:
String comparisons are performed lexicographically using Unicode code point values; 'a' (97) is less than 'b' (98).

9. What is the output of `console.log("10" < "9")`?

a) true
b) false
c) NaN
d) TypeError
Correct Answer: a) true
Explanation:
Since both operands are strings, comparison occurs character-by-character; '1' comes before '9' in Unicode, making "10" < "9" true.

10. What is the output of `console.log(10 < "9")`?

a) false
b) true
c) NaN
d) TypeError
Correct Answer: a) false
Explanation:
When comparing a number and a string, JavaScript converts the string to a number ("9" becomes 9), making 10 < 9 false.

11. What is the output of `console.log(1 + 2 + "3" + 4 + 5)`?

a) 3345
b) 12345
c) 15
d) 339
Correct Answer: a) 3345
Explanation:
Evaluated left to right: 1 + 2 = 3; 3 + "3" = "33"; "33" + 4 = "334"; "334" + 5 = "3345".

12. What will `console.log(+"" + +"1" + +"2")` return?

a) 3
b) 012
c) "012"
d) NaN
Correct Answer: a) 3
Explanation:
Unary plus converts +"" to 0, +"1" to 1, and +"2" to 2. Addition yields 0 + 1 + 2 = 3.

13. Which of the following operators has right-to-left associativity?

a) Ternary operator (?:)
b) Addition (+)
c) Strict equality (===)
d) Bitwise AND (&)
Correct Answer: a) Ternary operator (?:)
Explanation:
The ternary operator, assignment operators, unary operators, and exponentiation are right-to-left associative in JavaScript.

14. What is the result of `console.log(10 / "a")`?

a) NaN
b) Infinity
c) 0
d) TypeError
Correct Answer: a) NaN
Explanation:
Attempting division with a non-numeric string converts "a" to NaN, resulting in 10 / NaN, which is NaN.

15. What is the output of `console.log(NaN ** 0)`?

a) 1
b) NaN
c) 0
d) TypeError
Correct Answer: a) 1
Explanation:
According to ECMAScript standard for exponentiation, any base raised to the power of 0 (including NaN ** 0) returns 1.

16. What will `console.log(1 ** NaN)` output?

a) NaN
b) 1
c) 0
d) TypeError
Correct Answer: a) NaN
Explanation:
Raising 1 to the power of NaN evaluates to NaN according to the specification.

17. What is the output of `console.log(typeof (x => x))`?

a) function
b) object
c) undefined
d) arrow
Correct Answer: a) function
Explanation:
The typeof operator returns "function" for arrow function expressions.

18. What is the value of `x` after `let x = 10; x *= 2 + 3;`?

a) 50
b) 23
c) 25
d) 30
Correct Answer: a) 50
Explanation:
Assignment operators have lower precedence than arithmetic addition, so 2 + 3 is evaluated first (5), then x *= 5 (10 * 5 = 50).

19. What does the expression `delete arr[1]` do on an array `let arr = [10, 20, 30]`?

a) Removes element leaving an empty slot (undefined) at index 1 without changing array length
b) Removes element and shifts remaining elements left, changing array length
c) Throws a TypeError in strict mode
d) Replaces element at index 1 with 0
Correct Answer: a) Removes element leaving an empty slot (undefined) at index 1 without changing array length
Explanation:
The delete operator removes array element properties, creating a sparse array with an empty/undefined slot, while preserving original array length.

20. What is the output of `console.log(delete VariableName)` when `VariableName` was declared with `let`?

a) false
b) true
c) SyntaxError in strict mode
d) both a and c
Correct Answer: d) both a and c
Explanation:
In non-strict mode, deleting declared variables returns false. In strict mode, it throws a SyntaxError.

21. What does `console.log(1 in [10, 20, 30])` return?

a) true
b) false
c) 20
d) TypeError
Correct Answer: a) true
Explanation:
The 'in' operator checks for index/property existence. Index 1 exists in the array, so it returns true.

22. What does `console.log(20 in [10, 20, 30])` return?

a) false
b) true
c) 20
d) TypeError
Correct Answer: a) false
Explanation:
The 'in' operator checks for property key/index presence, not values. Index 20 does not exist in a 3-element array, returning false.

23. What is the result of `console.log(false == 0)`?

a) true
b) false
c) TypeError
d) undefined
Correct Answer: a) true
Explanation:
Abstract equality (==) coerces boolean false to number 0, yielding 0 == 0 which is true.

24. What is the result of `console.log(false == "")`?

a) true
b) false
c) TypeError
d) undefined
Correct Answer: a) true
Explanation:
Abstract equality (==) coerces both false and empty string "" to number 0, returning true.

25. What is the result of `console.log(false == [])`?

a) true
b) false
c) TypeError
d) undefined
Correct Answer: a) true
Explanation:
Empty array [] converts to empty string "", which coerces to 0. False also coerces to 0, making 0 == 0 evaluate to true.

26. What is the result of `console.log(false == {})`?

a) false
b) true
c) TypeError
d) undefined
Correct Answer: a) false
Explanation:
Plain object {} converts to string "[object Object]", which coerces to NaN. False converts to 0. 0 == NaN evaluates to false.

27. What will `console.log(typeof (void 0))` evaluate to?

a) undefined
b) void
c) number
d) null
Correct Answer: a) undefined
Explanation:
The expression `void 0` evaluates to primitive `undefined`, and passing `undefined` to `typeof` returns string "undefined".

28. Which unary operator deletes a property from an object?

a) delete
b) remove
c) void
d) clear
Correct Answer: a) delete
Explanation:
The `delete` operator removes a specified property from an object.

29. What is the result of `console.log(typeof (1, 2))`?

a) number
b) tuple
c) array
d) undefined
Correct Answer: a) number
Explanation:
The comma operator evaluates operands and returns the last one (2). Then `typeof 2` returns "number".

30. What is the result of `console.log(+true + +"2")`?

a) 3
b) true2
c) 12
d) NaN
Correct Answer: a) 3
Explanation:
Unary plus converts true to 1 and "2" to 2. Arithmetic addition evaluates 1 + 2 = 3.

31. What is the output of `console.log(3 ** 2 ** 2)`?

a) 81
b) 6561
c) 729
d) 512
Correct Answer: a) 81
Explanation:
Exponentiation is right-associative: 2 ** 2 = 4 first; then 3 ** 4 = 81.

32. What is the output of `console.log((3 ** 2) ** 2)`?

a) 81
b) 6561
c) 729
d) 512
Correct Answer: a) 81
Explanation:
Parentheses override standard precedence: (3 ** 2) = 9; then 9 ** 2 = 81.

33. What is the result of `console.log(~-1)`?

a) 0
b) -2
c) 1
d) -1
Correct Answer: a) 0
Explanation:
Bitwise NOT (~) formula is `-(x + 1)`. For x = -1: `-(-1 + 1) = -0`, which displays as integer 0.

34. What is the result of `console.log(~0)`?

a) -1
b) 0
c) 1
d) NaN
Correct Answer: a) -1
Explanation:
Bitwise NOT (~) formula is `-(x + 1)`. For x = 0: `-(0 + 1) = -1`.

35. Which of the following expressions will return `false`?

a) Boolean(new Boolean(false))
b) Boolean("0")
c) Boolean([])
d) Boolean(0)
Correct Answer: d) Boolean(0)
Explanation:
0 is a falsy primitive value. Object instances (`new Boolean(false)`), non-empty strings, and arrays are all truthy.

36. What is the output of `console.log(10 == true)`?

a) false
b) true
c) TypeError
d) undefined
Correct Answer: a) false
Explanation:
Boolean true coerces to number 1. The comparison becomes 10 == 1, which evaluates to false.

37. What is the output of `console.log(1 == true)`?

a) true
b) false
c) TypeError
d) undefined
Correct Answer: a) true
Explanation:
Boolean true coerces to number 1. Comparison 1 == 1 evaluates to true.

38. What is the result of `console.log("foo" || "bar")`?

a) foo
b) bar
c) true
d) false
Correct Answer: a) foo
Explanation:
Logical OR (||) short-circuits and returns the first truthy operand, which is "foo".

39. What is the result of `console.log("foo" && "bar")`?

a) bar
b) foo
c) true
d) false
Correct Answer: a) bar
Explanation:
Logical AND (&&) evaluates the second operand if the first is truthy, returning "bar".

40. What will `console.log(null || "bar")` return?

a) bar
b) null
c) true
d) false
Correct Answer: a) bar
Explanation:
Logical OR (||) encounters falsy `null` on the left, proceeding to return the right operand "bar".

41. What will `console.log(null && "bar")` return?

a) null
b) bar
c) false
d) undefined
Correct Answer: a) null
Explanation:
Logical AND (&&) encounters falsy `null` on the left and short-circuits, returning `null` immediately.

42. What is the output of `console.log([] + {})` in browser environment?

a) "[object Object]"
b) 0
c) NaN
d) TypeError
Correct Answer: a) "[object Object]"
Explanation:
Empty array converts to empty string ""; object converts to string "[object Object]". Concatenation produces "[object Object]".

43. What is the result of `console.log({} + [])` in expression context?

a) "[object Object]"
b) 0
c) NaN
d) TypeError
Correct Answer: a) "[object Object]"
Explanation:
When evaluated as an expression argument inside console.log(), {} converts to "[object Object]" and [] to "", concatenating to "[object Object]".

44. What does the expression `1 ?? 2` evaluate to?

a) 1
b) 2
c) undefined
d) null
Correct Answer: a) 1
Explanation:
The left operand 1 is defined (not null or undefined), so nullish coalescing operator returns 1.

45. What will `let a; a ??= 100; console.log(a);` output?

a) 100
b) undefined
c) null
d) TypeError
Correct Answer: a) 100
Explanation:
Variable `a` is uninitialized (undefined). Nullish assignment (`??=`) assigns 100 to `a`.

46. What will `let a = 5; a ??= 100; console.log(a);` output?

a) 5
b) 100
c) undefined
d) TypeError
Correct Answer: a) 5
Explanation:
Variable `a` is set to 5 (not nullish). Nullish assignment (`??=`) skips assignment and leaves `a` as 5.

47. Which of the following operators has the LOWEST precedence?

a) Yield operator (yield)
b) Conditional operator (?:)
c) Logical OR (||)
d) Equality (===)
Correct Answer: a) Yield operator (yield)
Explanation:
The yield operator in generator functions has precedence level 2, which is lower than conditional (3), logical OR (4), or equality (9).

48. What is the output of `console.log(typeof NaN)`?

a) number
b) NaN
c) undefined
d) object
Correct Answer: a) number
Explanation:
NaN is a special numeric value defined by the IEEE 754 standard, so `typeof NaN` returns "number".

49. What is the output of `console.log(typeof null)`?

a) object
b) null
c) undefined
d) primitive
Correct Answer: a) object
Explanation:
typeof null returning "object" is a historical bug in JS preserved for backwards compatibility.

50. What is the output of `console.log(typeof undefined)`?

a) undefined
b) object
c) null
d) void
Correct Answer: a) undefined
Explanation:
The type of primitive value undefined is string "undefined".

51. What will `console.log("10" - 5)` output?

a) 5
b) "105"
c) NaN
d) TypeError
Correct Answer: a) 5
Explanation:
Subtraction operator coerces string "10" into number 10, computing 10 - 5 = 5.

52. What will `console.log("10" + 5)` output?

a) 105
b) 15
c) NaN
d) TypeError
Correct Answer: a) 105
Explanation:
Binary addition operator with a string performs string concatenation, resulting in "105".

53. What is the result of `console.log(!!0)`?

a) false
b) true
c) 0
d) 1
Correct Answer: a) false
Explanation:
0 is a falsy value. Double negation (!!) coerces 0 into boolean false.

54. What is the result of `console.log(!!1)`?

a) true
b) false
c) 1
d) 0
Correct Answer: a) true
Explanation:
1 is a truthy value. Double negation (!!) coerces 1 into boolean true.

55. What is the result of `console.log(!!"")`?

a) false
b) true
c) ""
d) undefined
Correct Answer: a) false
Explanation:
Empty string "" is a falsy value. Double negation (!!) evaluates to boolean false.

56. What is the result of `console.log(!!{})`?

a) true
b) false
c) object
d) undefined
Correct Answer: a) true
Explanation:
An empty plain object {} is a truthy value, so double negation (!!) returns boolean true.

57. What is the result of `console.log(!![])`?

a) true
b) false
c) array
d) undefined
Correct Answer: a) true
Explanation:
An empty array [] is a truthy value in JavaScript, so double negation (!!) yields boolean true.

58. What will `console.log(10 % -3)` evaluate to?

a) 1
b) -1
c) 3
d) -3
Correct Answer: a) 1
Explanation:
In JavaScript remainder operator (%), the sign of the result matches the sign of the dividend (left operand). Positive 10 produces positive 1.

59. What will `console.log(-10 % 3)` evaluate to?

a) -1
b) 1
c) -3
d) 3
Correct Answer: a) -1
Explanation:
The sign of the remainder matches the dividend (left operand). Negative -10 produces negative remainder -1.

60. What will `console.log(-10 % -3)` evaluate to?

a) -1
b) 1
c) -3
d) 3
Correct Answer: a) -1
Explanation:
The sign of the remainder depends strictly on the dividend (-10), yielding -1 regardless of the divisor's sign.

61. What does the expression `typeof typeof typeof 1` return?

a) string
b) number
c) undefined
d) object
Correct Answer: a) string
Explanation:
1 step: `typeof 1` = "number". 2 step: `typeof "number"` = "string". 3 step: `typeof "string"` = "string".

62. What is the output of `console.log(1 < 2 < 3)`?

a) true
b) false
c) 3
d) TypeError
Correct Answer: a) true
Explanation:
Evaluated left to right: (1 < 2) is true. Then (true < 3) coerces true to 1, evaluating (1 < 3) which is true.

63. What is the output of `console.log(3 > 2 > 1)`?

a) false
b) true
c) 1
d) TypeError
Correct Answer: a) false
Explanation:
Evaluated left to right: (3 > 2) is true. Then (true > 1) coerces true to 1, evaluating (1 > 1) which is false.

64. Which operator evaluates two operands and returns true if both are truthy?

a) &&
b) ||
c) ??
d) ^
Correct Answer: a) &&
Explanation:
The logical AND operator (&&) checks if both expressions evaluate to truthy values.

65. Which operator evaluates two operands and returns true if at least one is truthy?

a) ||
b) &&
c) ??
d) &
Correct Answer: a) ||
Explanation:
The logical OR operator (||) checks if at least one expression evaluates to a truthy value.

66. What does `console.log(5 == "5.0")` evaluate to?

a) true
b) false
c) TypeError
d) undefined
Correct Answer: a) true
Explanation:
Abstract equality (==) coerces string "5.0" to number 5, making 5 == 5 evaluate to true.

67. What does `console.log(5 === "5.0")` evaluate to?

a) false
b) true
c) TypeError
d) undefined
Correct Answer: a) false
Explanation:
Strict equality operator (===) compares data types without coercion, returning false since number and string differ.

68. What is the output of `console.log(Infinity - Infinity)`?

a) NaN
b) 0
c) Infinity
d) -Infinity
Correct Answer: a) NaN
Explanation:
Subtracting Infinity from Infinity is an indeterminate mathematical form, returning NaN.

69. What is the output of `console.log(Infinity / Infinity)`?

a) NaN
b) 1
c) Infinity
d) 0
Correct Answer: a) NaN
Explanation:
Dividing Infinity by Infinity is mathematically undefined, returning NaN.

70. What is the output of `console.log(0 * Infinity)`?

a) NaN
b) 0
c) Infinity
d) TypeError
Correct Answer: a) NaN
Explanation:
Multiplying zero by Infinity is an indeterminate operation, returning NaN.

71. What is the result of `console.log(true ? 1 : 2, false ? 3 : 4)`?

a) 1 4
b) 1 3
c) 2 4
d) 2 3
Correct Answer: a) 1 4
Explanation:
The first ternary evaluates true (1). The second ternary evaluates false (4). Outputs 1 4.

72. What does the `new` operator do when invoked before a constructor function?

a) Creates a empty instance object, binds `this`, connects prototype, and returns the object
b) Converts function to arrow function
c) Freezes function scope
d) Executes function inside worker thread
Correct Answer: a) Creates a empty instance object, binds `this`, connects prototype, and returns the object
Explanation:
The `new` operator instantiates an object from a constructor function, setting up prototype linkage and internal `this` context.

73. What will `console.log("b" > "a")` output?

a) true
b) false
c) NaN
d) TypeError
Correct Answer: a) true
Explanation:
Character 'b' has a higher ASCII/Unicode code point (98) than 'a' (97), evaluating to true.

74. What will `console.log("A" > "a")` output?

a) false
b) true
c) NaN
d) TypeError
Correct Answer: a) false
Explanation:
Uppercase ASCII letters ('A' = 65) have smaller code points than lowercase letters ('a' = 97), making 'A' > 'a' false.

75. What is the result of `let a = 1; let b = a++; console.log(a, b);`?

a) 2 1
b) 2 2
c) 1 1
d) 1 2
Correct Answer: a) 2 1
Explanation:
Postfix increment (`a++`) returns current value (1) to `b`, then increments `a` to 2.

76. What is the result of `let a = 1; let b = ++a; console.log(a, b);`?

a) 2 2
b) 2 1
c) 1 2
d) 1 1
Correct Answer: a) 2 2
Explanation:
Prefix increment (`++a`) increments `a` to 2 first, then assigns the new value (2) to `b`.

77. What is the output of `console.log(10 == "10")`?

a) true
b) false
c) TypeError
d) undefined
Correct Answer: a) true
Explanation:
Abstract equality operator coerces string "10" to number 10, producing true.

78. What is the output of `console.log(10 === "10")`?

a) false
b) true
c) TypeError
d) undefined
Correct Answer: a) false
Explanation:
Strict equality checks value and type. Number 10 does not strictly match string "10".

79. What is the output of `console.log(typeof [])`?

a) object
b) array
c) list
d) undefined
Correct Answer: a) object
Explanation:
In JavaScript, arrays are objects. The `typeof` operator returns "object" for array references.

80. What is the output of `console.log(typeof {})`?

a) object
b) dictionary
c) struct
d) undefined
Correct Answer: a) object
Explanation:
The `typeof` operator returns string "object" for plain JavaScript object literals.

81. What will `console.log(10 + true)` output?

a) 11
b) 10true
c) 10
d) NaN
Correct Answer: a) 11
Explanation:
Addition converts boolean `true` to number 1, computing 10 + 1 = 11.

82. What will `console.log(10 + false)` output?

a) 10
b) 10false
c) 0
d) NaN
Correct Answer: a) 10
Explanation:
Addition converts boolean `false` to number 0, computing 10 + 0 = 10.

83. What will `console.log(10 + null)` output?

a) 10
b) 10null
c) NaN
d) TypeError
Correct Answer: a) 10
Explanation:
Numeric addition coerces `null` to number 0, yielding 10 + 0 = 10.

84. What will `console.log(10 + undefined)` output?

a) NaN
b) 10undefined
c) 10
d) TypeError
Correct Answer: a) NaN
Explanation:
Numeric addition coerces `undefined` to `NaN`, resulting in 10 + NaN = NaN.

85. What is the output of `console.log("10" - true)`?

a) 9
b) 10
c) NaN
d) TypeError
Correct Answer: a) 9
Explanation:
Subtraction operator forces numeric conversion on both operands: "10" becomes 10, true becomes 1. 10 - 1 = 9.

86. What is the output of `console.log("10" - false)`?

a) 10
b) 0
c) NaN
d) TypeError
Correct Answer: a) 10
Explanation:
Subtraction coerces "10" to 10 and false to 0, evaluating 10 - 0 = 10.

87. What is the output of `console.log("10" - null)`?

a) 10
b) 0
c) NaN
d) TypeError
Correct Answer: a) 10
Explanation:
Subtraction coerces "10" to 10 and null to 0, evaluating 10 - 0 = 10.

88. What is the output of `console.log("10" - undefined)`?

a) NaN
b) 10
c) 0
d) TypeError
Correct Answer: a) NaN
Explanation:
Subtraction coerces undefined to NaN, yielding 10 - NaN = NaN.

89. Which operator assigns a value only if the left variable is currently falsy?

a) ||=
b) &&=
c) ??=
d) ?=
Correct Answer: a) ||=
Explanation:
The logical OR assignment operator (`||=`) assigns the right operand to the left variable if the variable evaluates to falsy.

90. Which operator assigns a value only if the left variable is currently truthy?

a) &&=
b) ||=
c) ??=
d) =:
Correct Answer: a) &&=
Explanation:
The logical AND assignment operator (`&&=`) assigns the right operand to the left variable if the variable evaluates to truthy.

91. Which operator assigns a value only if the left variable is currently `null` or `undefined`?

a) ??=
b) ||=
c) &&=
d) ?=
Correct Answer: a) ??=
Explanation:
The logical nullish assignment operator (`??=`) assigns the right operand to the left variable if the variable is nullish.

92. What will `console.log(true ? "Yes" : "No")` output?

a) Yes
b) No
c) true
d) false
Correct Answer: a) Yes
Explanation:
Since the condition is boolean true, the ternary expression returns the first expression option ("Yes").

93. What will `console.log(false ? "Yes" : "No")` output?

a) No
b) Yes
c) true
d) false
Correct Answer: a) No
Explanation:
Since the condition is boolean false, the ternary expression returns the second expression option ("No").

94. What is the output of `console.log(+false)`?

a) 0
b) false
c) NaN
d) TypeError
Correct Answer: a) 0
Explanation:
The unary plus (+) operator explicitly converts boolean false to number 0.

95. What is the output of `console.log(+true)`?

a) 1
b) true
c) NaN
d) TypeError
Correct Answer: a) 1
Explanation:
The unary plus (+) operator explicitly converts boolean true to number 1.

96. What is the output of `console.log(+null)`?

a) 0
b) null
c) NaN
d) TypeError
Correct Answer: a) 0
Explanation:
The unary plus (+) operator explicitly converts null to number 0.

97. What is the output of `console.log(+undefined)`?

a) NaN
b) undefined
c) 0
d) TypeError
Correct Answer: a) NaN
Explanation:
The unary plus (+) operator attempts numeric conversion on undefined, which yields NaN.

98. What is the result of `console.log("10" / 2)`?

a) 5
b) "5"
c) NaN
d) TypeError
Correct Answer: a) 5
Explanation:
Division operator coerces string "10" into number 10, computing 10 / 2 = 5.

99. What is the result of `console.log("10" * 2)`?

a) 20
b) "20"
c) NaN
d) TypeError
Correct Answer: a) 20
Explanation:
Multiplication operator coerces string "10" into number 10, computing 10 * 2 = 20.

100. What is the result of `console.log("10" % 3)`?

a) 1
b) "1"
c) NaN
d) TypeError
Correct Answer: a) 1
Explanation:
Remainder operator coerces string "10" into number 10, computing 10 % 3 = 1.

101. What will `console.log(typeof (1 + "1"))` evaluate to?

a) string
b) number
c) undefined
d) object
Correct Answer: a) string
Explanation:
1 + "1" results in string concatenation ("11"). `typeof "11"` returns string "string".

102. What will `console.log(typeof (1 - "1"))` evaluate to?

a) number
b) string
c) undefined
d) object
Correct Answer: a) number
Explanation:
1 - "1" results in numeric subtraction (0). `typeof 0` returns string "number".
← Previous: JavaScript OOP MCQs for Developer Interviews & Certification
Next →: JavaScript Prototypes & Inheritance MCQs for Developer Interviews
Java Collections Frame Work MCQs

Java Collections Frame Work MCQs

The Java Collections Framework provides a unified architecture consisting of interfaces (such as List, Set, and Map) and implementation classes…

By MCQs Generator
C++ Arrays / Lists - MCQs

C++ Arrays / Lists - MCQs

Sequential data structures in C++ allow developers to store and manipulate contiguous collections of elements in memory. C++ provides multiple…

By MCQs Generator
C++ Control Flow / If-Else MCQs Conditional Statements

C++ Control Flow / If-Else MCQs Conditional Statements

Control flow statements determine the execution path of a program based on runtime conditions. In C++, decision-making relies primarily on…

By MCQs Generator