Limited access

Upgrade to access all content for this subject

Given that variable x is defined as an integer and assigned a 1-digit, 2-digit, or 3-digit number, consider the following code.

System.out.println((int) Math.sqrt(Math.abs(x)*x));

Which of the following scenarios will always cause this statement to print the value of x?

A

No 3-digit integers assigned to x would cause this statement to print the value of x.

B

Only when x is assigned an integer between 0 (inclusive) and 100 (inclusive).

C

When x is assigned any integer between -999 (inclusive) and 999 (inclusive).

D

Only when x is assigned a prime number between 1 and 999.

E

When x is assigned an integer between 0 (inclusive) and 999 (inclusive).

Select an assignment template