?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Arithmetic Evaluation Using Math Class Methods

APCSA-KKVG4E

Consider the following code.

double randNum = Math.random();
double answer = (int)(Math.pow((int)randNum*10, 2)) - Math.sqrt(Math.pow(randNum,2));

Which of the following will be the BEST approximate value of answer after this segment of code is run?

A

The value stored in randNum.

B

The value stored in randNum squared.

C

The negative of the value stored in randNum.

D

A random number between 1 (inclusive) and 16 (exclusive).

E

Always 0.