What is the result of the expression 5 * (1 + 2) - 3 in C?
A. 12
B. 15
C. 10
D. 6
Answer: Option A
Solution(By Examveda Team)
In C, arithmetic expressions follow the order of operations (PEMDAS/BODMAS), where parentheses have the highest precedence. Therefore, the expression (1 + 2) inside the parentheses is evaluated first, resulting in 3. Then, the multiplication is performed: 5 * 3, which equals 15. Finally, the subtraction is performed: 15 - 3, which equals 12.Option B (15) is incorrect because it represents the result of the multiplication but doesn't consider the subsequent subtraction.
Option C (10) is incorrect because it doesn't represent the correct result of the expression.
Option D (6) is incorrect because it doesn't consider both the multiplication and subtraction; the correct result is 12.
Related Questions on Operators and Expressions
What does the ++ operator do in C when applied to a variable?
A. Decrements by 1
B. Adds 1
C. Doubles the value
D. Leaves it unchanged
Join The Discussion