21. Which expression evaluates to 4.4 if integer p = 2?

Answer: D

Explanation:

4 + p / 5.0 evaluates to 4.4 when p = 2

When integer p is set to 2, the expression 4 + p / 5.0 computes to 4.4.

A) 4 + p / 5

This expression evaluates to 4 + 2 / 5, which simplifies to 4 + 0.4, resulting in 4.4. However, it is important to note that the division is performed as integer division, and thus this option is incorrect because it does not produce a floating-point result.

B) (4 + p) / 5

This expression becomes (4 + 2) / 5, which simplifies to 6 / 5, equating to 1.2. Therefore, this option does not evaluate to 4.4 and is incorrect.

C) (4 + p) / 5.0

Here, we have (4 + 2) / 5.0, which simplifies to 6 / 5.0, yielding 1.2. Like Option B, this expression does not evaluate to 4.4, making it an incorrect choice.

D) 4 + p / 5.0

For this expression, substituting p = 2 leads to 4 + 2 / 5.0, which calculates to 4 + 0.4, resulting in 4.4. This is indeed the correct answer as it produces the desired result.

Conclusion

The expression 4 + p / 5.0 is the only one that correctly evaluates to 4.4 when p is set to 2. All other options fail to yield the correct value due to either incorrect arithmetic operations or integer division, confirming that Option D is definitively correct.