?

AP® Computer Science Principles

Free Version

Upgrade subject to access all content

Moderate

Random Numbers

APCSP-1XMEGH

Assume that the variable x is assigned the following value:

x ← RANDOM(0,10)

Which of the following code segments would ensure that x is a random number between 2 and 32?

A

x * 2

B

(x + 2) * 30

C

(x * 30) + 2

D

None of these would work.