Q23
What is the result of the expression 2.5 + 2 in C?
A.
4.5
AnswerB.
4
C.
2.7
D.
2
Answer: Option A
Solution
Answer: Option A
Solution:
In C, when you add two floating-point numbers, as in the expression 2.5 + 2, the result is a floating-point number. Therefore, the result is 4.5.Option B (4) is incorrect because it represents an integer result, but the expression involves floating-point numbers.
Option C (2.7) is incorrect; it's not the result of the given expression.
Option D (2) is incorrect for the same reason as Option B; it represents an integer result, not a floating-point result.