Math Class - AP Computer Science A
Card 1 of 30
State the result of Math.max(3, 7).
State the result of Math.max(3, 7).
Tap to reveal answer
- Returns the larger of the two values.
- Returns the larger of the two values.
← Didn't Know|Knew It →
What is the result of Math.pow(2, 3)?
What is the result of Math.pow(2, 3)?
Tap to reveal answer
- Calculates $2^3 = 2 \times 2 \times 2$.
- Calculates $2^3 = 2 \times 2 \times 2$.
← Didn't Know|Knew It →
What is Math.E approximately equal to?
What is Math.E approximately equal to?
Tap to reveal answer
2.718281828459045. The mathematical constant e (Euler's number).
2.718281828459045. The mathematical constant e (Euler's number).
← Didn't Know|Knew It →
What does Math.subtractExact(-2147483648, 1) return?
What does Math.subtractExact(-2147483648, 1) return?
Tap to reveal answer
Throws ArithmeticException. Integer underflow causes ArithmeticException to be thrown.
Throws ArithmeticException. Integer underflow causes ArithmeticException to be thrown.
← Didn't Know|Knew It →
What is the return value of Math.addExact(2147483647, 1)?
What is the return value of Math.addExact(2147483647, 1)?
Tap to reveal answer
Throws ArithmeticException. Integer overflow causes ArithmeticException to be thrown.
Throws ArithmeticException. Integer overflow causes ArithmeticException to be thrown.
← Didn't Know|Knew It →
What is the result of Math.hypot(3, 4)?
What is the result of Math.hypot(3, 4)?
Tap to reveal answer
5.0. Calculates $\sqrt{3^2 + 4^2} = \sqrt{25} = 5$.
5.0. Calculates $\sqrt{3^2 + 4^2} = \sqrt{25} = 5$.
← Didn't Know|Knew It →
What is Math.PI approximately equal to?
What is Math.PI approximately equal to?
Tap to reveal answer
3.141592653589793. The mathematical constant $\pi$ (pi).
3.141592653589793. The mathematical constant $\pi$ (pi).
← Didn't Know|Knew It →
What does Math.toRadians(180) return?
What does Math.toRadians(180) return?
Tap to reveal answer
$\frac{\text{PI}}{1}$ radians. Converts 180 degrees to radians using $\pi$ radians per 180 degrees.
$\frac{\text{PI}}{1}$ radians. Converts 180 degrees to radians using $\pi$ radians per 180 degrees.
← Didn't Know|Knew It →
State the formula for calculating the hypotenuse using Math methods.
State the formula for calculating the hypotenuse using Math methods.
Tap to reveal answer
$Math.sqrt(a^2 + b^2)$. Uses the Pythagorean theorem for right triangle hypotenuse.
$Math.sqrt(a^2 + b^2)$. Uses the Pythagorean theorem for right triangle hypotenuse.
← Didn't Know|Knew It →
What is the result of Math.random() * 10?
What is the result of Math.random() * 10?
Tap to reveal answer
A random double between 0.0 and 10.0. Multiplies random value by 10 to scale the range.
A random double between 0.0 and 10.0. Multiplies random value by 10 to scale the range.
← Didn't Know|Knew It →
What does Math.floor(3.7) return?
What does Math.floor(3.7) return?
Tap to reveal answer
3.0. Rounds down to the nearest integer value.
3.0. Rounds down to the nearest integer value.
← Didn't Know|Knew It →
What is the return value of Math.min(-2, -5)?
What is the return value of Math.min(-2, -5)?
Tap to reveal answer
-5. Returns the smaller of the two values.
-5. Returns the smaller of the two values.
← Didn't Know|Knew It →
State the result of Math.max(3, 7).
State the result of Math.max(3, 7).
Tap to reveal answer
- Returns the larger of the two values.
- Returns the larger of the two values.
← Didn't Know|Knew It →
What does Math.sqrt(16) return?
What does Math.sqrt(16) return?
Tap to reveal answer
4.0. Returns the square root of 16, which is 4.
4.0. Returns the square root of 16, which is 4.
← Didn't Know|Knew It →
What does Math.abs(-5) return?
What does Math.abs(-5) return?
Tap to reveal answer
- Returns the absolute value, removing the negative sign.
- Returns the absolute value, removing the negative sign.
← Didn't Know|Knew It →
What does Math.round(4.5) return?
What does Math.round(4.5) return?
Tap to reveal answer
- Rounds to the nearest integer using banker's rounding.
- Rounds to the nearest integer using banker's rounding.
← Didn't Know|Knew It →
What is the result of Math.ceil(4.2)?
What is the result of Math.ceil(4.2)?
Tap to reveal answer
5.0. Rounds up to the nearest integer value.
5.0. Rounds up to the nearest integer value.
← Didn't Know|Knew It →
State the formula for calculating the hypotenuse using Math methods.
State the formula for calculating the hypotenuse using Math methods.
Tap to reveal answer
$Math.sqrt(a^2 + b^2)$. Uses the Pythagorean theorem for right triangle hypotenuse.
$Math.sqrt(a^2 + b^2)$. Uses the Pythagorean theorem for right triangle hypotenuse.
← Didn't Know|Knew It →
What does Math.subtractExact(-2147483648, 1) return?
What does Math.subtractExact(-2147483648, 1) return?
Tap to reveal answer
Throws ArithmeticException. Integer underflow causes ArithmeticException to be thrown.
Throws ArithmeticException. Integer underflow causes ArithmeticException to be thrown.
← Didn't Know|Knew It →
What does Math.round(4.5) return?
What does Math.round(4.5) return?
Tap to reveal answer
- Rounds to the nearest integer using banker's rounding.
- Rounds to the nearest integer using banker's rounding.
← Didn't Know|Knew It →
What is Math.PI approximately equal to?
What is Math.PI approximately equal to?
Tap to reveal answer
3.141592653589793. The mathematical constant $\pi$ (pi).
3.141592653589793. The mathematical constant $\pi$ (pi).
← Didn't Know|Knew It →
What does Math.abs(-5) return?
What does Math.abs(-5) return?
Tap to reveal answer
- Returns the absolute value, removing the negative sign.
- Returns the absolute value, removing the negative sign.
← Didn't Know|Knew It →
What does Math.sqrt(16) return?
What does Math.sqrt(16) return?
Tap to reveal answer
4.0. Returns the square root of 16, which is 4.
4.0. Returns the square root of 16, which is 4.
← Didn't Know|Knew It →
What is the return value of Math.addExact(2147483647, 1)?
What is the return value of Math.addExact(2147483647, 1)?
Tap to reveal answer
Throws ArithmeticException. Integer overflow causes ArithmeticException to be thrown.
Throws ArithmeticException. Integer overflow causes ArithmeticException to be thrown.
← Didn't Know|Knew It →
What is the result of Math.hypot(3, 4)?
What is the result of Math.hypot(3, 4)?
Tap to reveal answer
5.0. Calculates $\sqrt{3^2 + 4^2} = \sqrt{25} = 5$.
5.0. Calculates $\sqrt{3^2 + 4^2} = \sqrt{25} = 5$.
← Didn't Know|Knew It →
What is the result of Math.pow(2, 3)?
What is the result of Math.pow(2, 3)?
Tap to reveal answer
- Calculates $2^3 = 2 \times 2 \times 2$.
- Calculates $2^3 = 2 \times 2 \times 2$.
← Didn't Know|Knew It →
What is Math.E approximately equal to?
What is Math.E approximately equal to?
Tap to reveal answer
2.718281828459045. The mathematical constant e (Euler's number).
2.718281828459045. The mathematical constant e (Euler's number).
← Didn't Know|Knew It →
What is the result of Math.ceil(4.2)?
What is the result of Math.ceil(4.2)?
Tap to reveal answer
5.0. Rounds up to the nearest integer value.
5.0. Rounds up to the nearest integer value.
← Didn't Know|Knew It →
What is the result of Math.random() * 10?
What is the result of Math.random() * 10?
Tap to reveal answer
A random double between 0.0 and 10.0. Multiplies random value by 10 to scale the range.
A random double between 0.0 and 10.0. Multiplies random value by 10 to scale the range.
← Didn't Know|Knew It →
What does Math.toRadians(180) return?
What does Math.toRadians(180) return?
Tap to reveal answer
$\frac{\text{PI}}{1}$ radians. Converts 180 degrees to radians using $\pi$ radians per 180 degrees.
$\frac{\text{PI}}{1}$ radians. Converts 180 degrees to radians using $\pi$ radians per 180 degrees.
← Didn't Know|Knew It →