Time Left - 12:00 mins

# BARC 2020: Compiler Design Nuclear Quiz 1 (App update required to attempt this test)

Attempt now to get your rank among 855 students!

Question 1

Which one of the following options is true?

Question 2

How many derivation trees are there for string aaa given grammar G?

S → aS | Sa | a

S → aS | Sa | a

Question 3

When there is a reduce/reduce conflict?

Question 4

Number of elements in follow of A in the following grammar?

T-> AB

A-> a/b

B-> c/d

Question 5

Any directed acyclic graph must have

Question 6

Consider the DAG with V={1,2,3,4,5,6}

1) 1 2 3 4 5 6

2) 1 3 2 4 5 6

3) 1 3 2 4 6 5

4) 3 2 4 1 6 5

How many of the above are correct topological sorting?

Question 7

Write the output of following SDT __________ .

Alpha -> $Beta& {printf(“1”);} | ##Gamma @ {printf(“2”);}

Beta -> #Alpha# {printf(“3”);}

Gamma -> &Gamma& {printf(“4”);} | Beta {printf(“5”);} |# {printf(“6”);}

Non-terminals (V) = {Alpha , Beta, Gamma}

Terminals (T) = { $, &, #, @ }

String : $ # # # # # # # @ # @ # &

Question 8

Consider the following grammar with corresponding synthesized attributes.

F.L {F. val=L. val}

LLB {L.len= L

LB {L. len=1, L. val=B. val/2}

B0 {B. val =0}

B1 {B. val =1}

If “F.val” gives the value of the binary fraction generated by F in the above grammar then that will be the value of F.val on input .101?

F.L {F. val=L. val}

LLB {L.len= L

_{1}.len+1, L. val= L_{1}. val + 2^{-L.len}B.val}LB {L. len=1, L. val=B. val/2}

B0 {B. val =0}

B1 {B. val =1}

If “F.val” gives the value of the binary fraction generated by F in the above grammar then that will be the value of F.val on input .101?

Question 9

How many tokens present in given code

#include<stdio.h>

Question 10

Consider the following grammar:

Non terminals - S, A, B, C

Terminals - a, b, c

€ - Epsilon

S --> abABC

A --> bc / a

B --> a / c /€

C --> b / €

How many elements will be there in follow of A?

- 855 attempts
- 2 upvotes
- 7 comments

Mar 6GATE & PSU CS

Posted by: