GATE CSE 2024 Session 1 Q33: Evaluate an expression under unusual precedence and associativity
- Compiler Design
- 1 mark
- NAT
- No negative marking
Question
Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below.
| Operator | Precedence | Associativity |
|---|---|---|
| Highest | Left | |
| High | Right | |
| Medium | Right | |
| Low | Right |
The value of the expression as per the above rules is __________
Try it: numerical answer: type the value
Numerical answer. No negative marking.
Show answer and explanation
Answer: 6 (official GATE 2024 final answer key)
Concept used: Parenthesise by precedence first, then group equal operators by associativity.
First step: Do the additions first: and , giving .
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2024 Session 1 CS question paper and final answer key, organised by IISc Bangalore. Question paper · Answer key
More Compiler Design PYQs
- 2026 Session 1 · Q27Classify errors in three C string declarations
- 2026 Session 1 · Q28True statements about LL(1) parsing
- 2026 Session 1 · Q42Redundant (common) subexpressions in blocks B4 and B5 of a CFG
- 2026 Session 1 · Q53Compare two SDDs for type declarations
- 2026 Session 2 · Q35Count tokens produced by a lexer for a given string
- 2026 Session 2 · Q41Shift-reduce conflicts in the LR(0) table of a grammar