WGU Scripting-and-Programming-Foundations Question Answer
Which expression evaluates to 3.7 if float x = 17.0?
X + 2 / 10
(2 + x) / 10.0
X + 2.0 / 10
2 + x / 10
A. X + 2 / 10:
First, calculate 2 / 10, which is 0.2.
Then add x (17.0) to 0.2, resulting in 17.2. This does not equal 3.7.
B. (2 + x) / 10.0:
First, add 2 and x (17.0), which gives 19.0.
Then divide 19.0 by 10.0, resulting in 3.7.
C. X + 2.0 / 10:
First, calculate 2.0 / 10, which is 0.2.
D. 2 + x / 10:
First, divide x (17.0) by 10, which gives 1.7.
Then add 2 to 1.7, resulting in 3.7.
Therefore, option B is the correct expression.
TESTED 01 Jan 2026
Copyright © 2014-2026 ACE4Sure. All Rights Reserved