Difficulty: Easy
Correct Answer: 2134
Explanation:
Introduction / Context:
Reasoning about complex expressions often requires knowing which classes of operators bind tighter than others. C groups operators by precedence levels. This question asks you to order four broad classes correctly.
Given Data / Assumptions:
Concept / Approach:
Arithmetic operators (+, -, *, /, %) have higher precedence than relational operators (<, <=, >, >=). Relational operators, in turn, bind tighter than logical operators (&&, ||). The assignment operators (=, +=, etc.) are among the lowest. Therefore, the order from highest to lowest is: Arithmetic → Relational → Logical → Assignment.
Step-by-Step Solution:
Place Arithmetic first (2).Next place Relational (1).Then Logical (3).Finally Assignment (4).Concatenate: 2 1 3 4 → 2134.
Verification / Alternative check:
Consider 3 + 2 > 4 && flag = 1; The arithmetic part 3 + 2 is grouped first, then the relational comparison, then logical AND, and only then the assignment executes.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing evaluation order with precedence; logical operators short-circuit but still have lower precedence than relational operators.
Final Answer:
2134.
Discussion & Comments