GATE 2024 Compiler Design Foundation Quiz 96
Attempt now to get your rank among 20 students!
Question 1
Consider the syntax directed translation grammar as:
A → $B& {printf(“1”);} | ##G@{printf(“2”);}
B → #A# {printf(“3”);}
G → &G& {printf(“4”);} | B{printf(“5”);} |#{printf(“6”);}
The non-terminals and terminals for the above grammar is (V) = {A , B, G} and (T) = { $, &, #, @ }, respectively. The string that has to be parsed is $ # # # # # # # @ # @ # &. What is the output of following SDT given above?
Question 2
Question 3
a=2+3*4/3-2*1+3/2-1
The following precedence rules are used in the above expression:
1. order of precedence from highest to lowest:
-,+,*,/
2. + is right associative
3. * is left associative
4. - is right associative
5. / is right associative
What is the value of a after evaluation of an expression using the given rules?
Question 4
Which of the following expression has above DAG representation?
Question 5
S → TR
T → T – R {print (‘–’)}|R
R → + T {print (‘+’)}R|F
F → id {print (id.value)}|ϵ
For an input scheme 10 – 5 + 4, this scheme will print
- 20 attempts
- 0 upvotes
- 0 comments