Math Class MCQ Practice

Question 1 of 10

A trail map stores a descent of -19 meters. What value does drop hold?

int drop = Math.abs(-19);
  1. A. -19
  2. B. 19
  3. C. 19.0
  4. D. 0

Question 2 of 10

A survey plot is a perfect square of area 81. What value does side hold?

double side = Math.sqrt(81);
  1. A. 9
  2. B. 9.0
  3. C. 81
  4. D. 40.5

Question 3 of 10

A ranger scales a 2-meter grid four times. What value does span hold?

double span = Math.pow(2, 4);
  1. A. 8.0
  2. B. 16
  3. C. 16.0
  4. D. 6.0

Question 4 of 10

What value does clipped hold?

int clipped = (int) Math.sqrt(20);
  1. A. 4.47
  2. B. 5
  3. C. 4
  4. D. 20

Question 5 of 10

Which statement about Math.random() is correct?

  1. A. It returns an int from 0 through 1 inclusive.
  2. B. It returns a double in the half-open interval [0.0, 1.0).
  3. C. It returns a double in the closed interval [0.0, 1.0].
  4. D. It returns an int from 1 through 10.

Question 6 of 10

Which integers can this expression produce?

(int) (Math.random() * 8)
  1. A. 0 through 8 inclusive
  2. B. 1 through 8 inclusive
  3. C. 0 through 7 inclusive
  4. D. 0.0 through 7.999... as doubles

Question 7 of 10

A trail app needs a random int from 4 through 9 inclusive. Which expression is correct?

  1. A. (int) (Math.random() * 9) + 4
  2. B. (int) (Math.random() * 6) + 4
  3. C. (int) (Math.random() * 6) + 9
  4. D. (int) (Math.random() * 4) + 9

Question 8 of 10

A supplied Math.random() result is 0.4. What value does post hold?

int post = (int) (0.4 * 10);
  1. A. 4.0
  2. B. 5
  3. C. 4
  4. D. 0

Question 9 of 10

Which statement about this table of Math expressions is true?

Expression Result type
Math.abs(-3) int
Math.abs(-3.25) double
Math.sqrt(16) double
Math.pow(2, 3) double
  1. A. Only the abs(-3) row is correct; the others return int.
  2. B. sqrt and pow return int; abs always returns double.
  3. C. Every listed pair is correct.
  4. D. abs(-3.25) returns int 3.

Question 10 of 10

A wind reading is -4.9. What value does shown hold?

int shown = (int) Math.abs(-4.9);
  1. A. -4
  2. B. 5
  3. C. 4
  4. D. 4.9