JavaScript Numbers & Math Operations Quiz
Master 75 JavaScript questions that cover numeric literals, parsing, formatting, math utilities, and the edge cases every engineer hits when working with numbers.
Question 1
What value is printed when you log the numeric literal 1_000_000 in modern JavaScript?
Question 2
Which statement correctly declares a numeric literal using exponential notation?
Question 3
What is the result of typeof 42?
Question 4
Which statement about the Number constructor is accurate?
Question 5
What does Number.MAX_SAFE_INTEGER represent?
Question 6
What is the result of 0 / 0 in JavaScript?
Question 7
Which expression evaluates to positive Infinity?
Question 8
How can you reliably test if a value is NaN?
Question 9
What does Number.isFinite(Infinity) return?
Question 10
Which operation results in -Infinity?
Question 11
What is the result of 5 + 2 * 3 according to JavaScript operator precedence?
Question 12
What does 10 - "3" evaluate to?
Question 13
What is the outcome of 20 % 6?
Question 14
What does the expression (5 ** 2) ** 3 return?
Question 15
What value do you get from +"8" + 2?
Question 16
What does Number("0xF") return?
Question 17
Which expression converts a binary string "1010" to the number 10?
Question 18
What is the result of Number(true)?
Question 19
What does parseFloat("12.34px") return?
Question 20
How can you convert the string "005" to the number 5 without leaving leading zeros?
Question 21
What does parseInt("08", 10) return?
Question 22
What does parseInt("0b101", 2) return?
Question 23
How does parseFloat handle the string "Infinity"?
Question 24
What is the output of parseInt("123.45")?
Question 25
Which option produces NaN when parsed with parseInt?
Question 26
What does (1234.567).toFixed(2) return?
Question 27
Which method formats a number using locale-aware separators?
Question 28
What is the output of (0.00012345).toExponential(2)?
Question 29
How can you format 1234.5 as currency in US locale?
Question 30
What does Number(123456789).toString(16) produce?
Question 31
What does Math.abs(-7) return?
Question 32
Which statement about Math.sqrt is correct?
Question 33
What is the value of Math.max(3, 7, -2, 9)?
Question 34
Which expression returns the smallest number among an array of values?
Question 35
What does Math.sign(-42) return?
Question 36
What range of values can Math.random() return?
Question 37
How would you generate a random integer between 0 and 9 (inclusive)?
Question 38
Why is Math.random() unsuitable for cryptographic randomness?
Question 39
Which approach generates a random integer between a min and max inclusive?
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}Question 40
What is an effective way to simulate a dice roll (1-6)?
Question 41
What is the result of 0.1 + 0.2 === 0.3?
Question 42
How can you compare floating point numbers safely?
Question 43
What does Number.EPSILON represent?
Question 44
Which method can help mitigate floating point rounding issues when dealing with currency?
Question 45
What is the effect of Number.parseFloat compared to the global parseFloat?
Question 46
Which check correctly identifies integers?
Question 47
What does Number.isFinite("10") return?
Question 48
Which expression detects safe integers?
Question 49
How can you test whether a value is NaN using only comparisons?
Question 50
What does typeof Number("5") return?
Question 51
What does 2 ** 5 evaluate to?
Question 52
Which expression mirrors Math.pow(4, 3)?
Question 53
What is the value of Math.pow(9, 0.5)?
Question 54
Which statement about exponentiation assignment is correct?
Question 55
What is the result of Math.pow(-2, 3)?
Question 56
What does 10 % 4 return?
Question 57
How does JavaScript define the sign of the modulus result?
Question 58
What does -7 % 5 evaluate to?
Question 59
Which snippet computes the remainder safely for floating point numbers?
Question 60
What is the result of 15 % -4?
Question 61
What does Math.round(2.5) return?
Question 62
What is the result of Math.round(-1.5)?
Question 63
What does Math.ceil(2.01) return?
Question 64
What does Math.floor(-2.01) evaluate to?
Question 65
What is the output of Math.trunc(-2.7)?
Question 66
What does Math.min() return when called with no arguments?
Question 67
What value does Math.max() return with no arguments?
Question 68
What is the result of Math.max(...[1, 5, 2])?
Question 69
What does Math.min(Infinity, 42, -5) return?
Question 70
What is the outcome of Math.max(-10, -Infinity, -2)?
Question 71
What value results from Number((1.005).toFixed(2))?
Question 72
What does Number("") evaluate to?
Question 73
What does Number.isNaN(parseInt("foo", 10)) return?
Question 74
What is the result of Number.isFinite(parseFloat("Infinity"))?
Question 75
What does Math.min(1, NaN, 3) return?
