curriculum/challenges/english/blocks/quiz-javascript-math/66edc3ab8c6413c344f401bf.md
To pass the quiz, you must correctly answer at least 18 of the 20 questions below.
What does NaN stand for?
Numeric and Number
Not a Null
Null and Number
Not a Number
Which of the following is NOT an arithmetic operator in JavaScript?
*
+
-
??
What happens if you try to divide by zero in JavaScript?
JavaScript will output 0.
Nothing will happen.
JavaScript will throw an error.
JavaScript will output Infinity
Which of the following is the correct use of the exponentiation operator?
2*3
2#3
2%3
2**3
Which operator should you use when decrementing a variable in JavaScript?
++
//
**
--
Which of the following is NOT a bitwise operator?
&
|
^
>
Which of the following is the correct compound operator for getting the remainder?
//=
\=
%%=
%=
What is the difference between the == and === operators?
There is no difference. The comparison result will always have the same result.
The == operator is used to check if the data type is the same while the === is used to check if the value is equal.
The == operator can only be used with primitive types while the === operator is only used for objects.
The == operator only compares values whereas the === operator compares values and types.
What is the unary plus operator (+) used for?
It is used to decrement a value by one.
It is used to get the remainder from an operation.
It is used to invert the binary representation of a number.
It is used to convert its operand into a number.
Which of the following Math methods rounds a value to the nearest whole integer?
Math.trunc()
Math.max()
Math.min()
Math.round()
What does the Math.sqrt() method do?
This method returns a random floating point number.
This method returns the absolute value for a number.
This method returns the cube of a number.
This method returns the square root of a number.
Which of the following is NOT a valid method for the Math object?
Math.ceil()
Math.pow()
Math.abs()
Math.extend()
Which of the following will return false?
isNaN("Matt")
isNaN()
isNaN(undefined)
isNaN(7)
What does the parseFloat() method do?
It parses a string argument and performs a bitwise operation on it.
It parses a string argument and returns false.
It parses a string argument and returns an integer.
It parses a string argument and returns a floating-point number.
What will be logged to the console?
let num = 5;
console.log(++num);
error
null
5
6
What would be the output for the following code?
console.log(5 == '5');
undefined
false
null
true
What is operator precedence?
Operator precedence is used to check if the value on the left is less than the one on the right.
Operator precedence is used to raise a variable to the power of the specified number and reassigns the result to the variable.
Operator precedence is used to increase the value by one.
Operator precedence determines the order in which operations are evaluated in an expression.
Which of the following is NOT a comparison operator?
>
>=
<
!>
What does the unary negation operator (-) do?
It flips the boolean value of its operand.
It decreases the value by one.
It increases the value by one.
It negates the operand.
Which of the following is an example of using the nullish coalescing operator?
const userSettings = {
theme: null,
volume: 0,
notifications: false,
};
userSettings.theme () 'light';
const userSettings = {
theme: null,
volume: 0,
notifications: false,
};
userSettings.theme ** 'light';
const userSettings = {
theme: null,
volume: 0,
notifications: false,
};
userSettings.theme \\ 'light';
const userSettings = {
theme: null,
volume: 0,
notifications: false,
};
userSettings.theme ?? 'light';