Match C operators with their precedence (1 = highest, 4 = lowest): (A) ! (logical NOT), (B) < and > (relational), (C) * (multiplication), (D) = (assignment).

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:

  • (A) ! (unary logical NOT)
  • (B) < and > (relational operators)
  • (C) * (multiplication)
  • (D) = (assignment)
  • Scale: 1 highest priority … 4 lowest priority


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:

Assign ! → precedence 1 (highest among the set).Assign * → precedence 2 (multiplicative tier).Assign <,> → precedence 3 (relational tier).Assign = → precedence 4 (assignment, very low).


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

More Questions from Matching Questions

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion