Difficulty: Easy
Correct Answer: A-1, B-3, C-2, D-4
Explanation:
Introduction / Context:
Operator precedence in C determines how expressions are grouped without parentheses. Misunderstanding precedence leads to subtle logic errors. This item maps four widely used operators to an ordered precedence scale (1 = highest, 4 = lowest) consistent with standard C rules.
Given Data / Assumptions:
Concept / Approach:
In C, unary operators (like !) bind tighter than multiplicative operators. Multiplicative operators (*, /, %) bind tighter than additive, relational, equality, logical, and assignment operators. Relational operators (<, >, <=, >=) have lower precedence than multiplicative but higher than assignment. The assignment operator = has among the lowest precedence.
Step-by-Step Solution:
Verification / Alternative check:
Check expression: a = b < c * d parses as a = (b < (c * d)), confirming * precedes relational, and relational precedes assignment; similarly !x * y parses as (!x) * y.
Why Other Options Are Wrong:
Any mapping that places relational above multiplicative or assignment above relational contradicts the C precedence table; placing ! below * is also incorrect.
Common Pitfalls:
Confusing precedence with associativity; assuming logical operators always evaluate last (only assignment is lower among this set).
Final Answer:
A-1, B-3, C-2, D-4
Discussion & Comments