GATE CS 2022 | Question 65

Compiler Design › Basics & Lexical · NAT · 2 marks · Answer: 80

  1. Question 65Compiler Designnat2 marks
    Grammar with rules: ; ; ; ; (# and % are operators, id an integer). The computed for the root of the parse tree of is __________.

    Answer: 80

    Solution

    Answer: 80 Rules: (so # means multiply) and (so % means divide), left-associative with % binding tighter than #. Expression groups as :
    10 % 5         = 2
    8 % 2 % 2      = (8/2)/2 = 2
    20 * 2 * 2     = 80

More GATE PYQ on Basics & Lexical

All GATE CS Compiler Design PYQ →

Attempt GATE CS 2022 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →