0% found this document useful (0 votes)
3 views

Compiler-10

The document is a question paper for the Design of Language Processor course at Charotar University, scheduled for December 23, 2020. It consists of multiple-choice questions and descriptive questions covering topics such as grammar, symbol tables, parsing, and code generation. The exam is structured into two sections, with a total of 70 marks and a duration of 225 minutes.

Uploaded by

jaymehta11th
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Compiler-10

The document is a question paper for the Design of Language Processor course at Charotar University, scheduled for December 23, 2020. It consists of multiple-choice questions and descriptive questions covering topics such as grammar, symbol tables, parsing, and code generation. The exam is structured into two sections, with a total of 70 marks and a duration of 225 minutes.

Uploaded by

jaymehta11th
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Question Paper - Evaluator view

Exam Date & Time: 23-Dec-2020 (02:00 PM - 05:45 PM)

CHAROTAR UNIVERSITY OF SCIENCE AND TECHNOLOGY

Design of Language Processor [CE442]


Marks: 70 Duration: 225 mins.
Section -I (MCQ)
Answer all the questions.
1) S → aA | *S
A → +S | (S | ε
Set {+, ( } will be in the (2)

1) First (A) 2) First (E) 3) Follow (E) 4) Follow (A)


2) Choose the correct statement

A given language is Two different


Language corresponding to a given All of (1)
ambiguous if no grammars may
1) grammar, is the set of all strings that 2) 3) 4) the
unambiguous grammar generate the same
can be generated by the given grammar above
exists for it language
3) Consider the below given program. Line no. 5 currently in execution. How many symbol tables are currently available in memory?

(1)

1) 1 2) 2 3) 3 4) 4
4) In assembler, OPTAB is

Generated by analysis phase and Generated by synthesis phase and Used by analysis phase as (1)
1) 2) 3)
used by synthesis phase used by analysis phase well as synthesis phase
5) Which one of the following is invalid three address code?

x[i]=y[i x[i]=y[j (1)


1) a = b 2) 3) 4) a = &b
] ]
6) Consider the given code. If the value of i is 3 and line number 6 is in execution the how many activation records are present in then
control stack?

(1)
1) 1 2) 2 3) 3 4) 5
7) S → Sa | b
Which of the following is True?
(2)
There will be SR conflict There will be RR conflict There will be There will be
1) 2) 3) 4)
during parsing during Parsing both conflict no conflict
8) The equivalent expression for the DAG is

(1)

a + (b*c –
1) ((a + b) *c) *(b*(c – a)) 2) 3) (a + (b*c))*((b*c) – a) 4) a*(a + b * c) – a
a)
9) Which one of the following is not the macro pre-processor data structure?
(1)
1) APTAB 2) SYMTAB 3) SSNTAB 4) MNT
10) P → PαQ | Q Q → QβR | R R → num
If 2α3α4β1α2β1 is evaluated to 18, then which of the following is the correct value for β and α ? (2)

1) +, * 2) +,- 3) -,* 4) -,+


11) Consider the following grammar.
S → aB | aAb
A → bAb | a
B → aB | ε (2)
How many back tracks are required to generate the string aab from the above grammar?

1) 1 2) 2 3) 3 4) 4
12) _____ is the first software to run when the computer is switched on

Bootstrap Linking Absolute (1)


1) Operating system 2) 3) 4)
loader loader loader

13) Select the correct one from the following.

Static (1)
Control stack keep State gives In case of heap allocation, same
allocation
1) track of all process 2) information of storage 3) storage is allocated for each 4)
can grow at
activation. and value binding. activation of the process.
run time.
14) Size of the data object must be known in case of

Static Stack Heap Stack and Heap (1)


Static and Stack
1) memory 2) memory 3) memory 4) 5) memory
memory allocation
allocation allocation allocation allocation
15) Select the correct one for semantic rule evaluation method.

Dependency
In parse tree-based In rules-based Parse tree based and
graph is not (1)
methods dependency methods is oblivious methods both are
1) 2) 3) 4) constructed in
graph is not evaluation order is more efficient then rule
rule based
constructed. decided at run time. based methods.
method.
16) Identify the phase of a compiler detecting following types of errors/warnings.
S → aB | aAb
A → bAb | a
B → aB | ε
(1)

1) (a)(2), (b)(1), (c)(3) 2) (a)(3), (b)(1), (c)(2) 3) (a)(1), (b)(2), (c)(3) 4) (a)(3), (b)(2), (c)(1)
Section II-A
Answer 5 out of 7 questions.
17) Check whether below grammar is LL (1) or not. Justify your answer

S -> aAa | BAa | ^ (5)


A-> c A | b A | ^
B-> b

18) Symbol Table is an important data structure created and maintained by the compiler. What information is stored in symbol table?
Also explain which data structures are used to implement symbol table with its pros and cons.( (5)

19) Deign Syntax Direction Translation (SDT), which can process below given input string. Also construct annotated parse tree and
dependency graph for the same input string. Follow the precedence rule of C programming while processing the string. (5)
Input string: a = b + c * (d – f)

20) Construct CLR parsing table for below grammar.


M -> NN
N -> c N (5)
N -> d

21) Find basic block and draw control graph for following code written in higher level language.

(5)

22) Generate the machine code for the given assembly code.

(5)
23) Generate three address code for below expression. Also show implementation ways using (a) Quadruple (b) triple and (c) Indirect
triple.
(5)
Expression: a + ( b * c)* d ^ e
Section II-B
Answer 5 out of 6 questions.
24) Explain the technique that reduces the amount of overhead required to process an input character during scanning process. (5)

25) Compute First () and Follow () for below grammar

(5)

26) Generate SLR parsing table for following grammar and check whether grammar is SLR or not.
E -> E + T
E -> T (5)
T -> id | ( E )
T -> id

27) What is run time environment? Give brief idea of memory allocation done during compilation with block structured language. What
are the limitations of stack based memory allocation? (5)

28) Code generation phase of the compiler takes an intermediate code as an input and generates target machine code as an output.
Discuss some common issues in design of the code generator phase. (5)

29) Process the given macro and show the entries of all macro pre-processor data structures

(5)

-----End-----

You might also like