0% found this document useful (0 votes)
23 views4 pages

CS450 - DLP - External Exam

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)
23 views4 pages

CS450 - DLP - External Exam

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: 20-Nov-2023 (01:15 PM - 04:30 PM)

CHAROTAR UNIVERSITY OF SCIENCE AND TECHNOLOGY


University Examination Nov 2023
Seventh Semester of B.Tech. (CS)
Design of Language Processor [CS450]
Marks: 70 Duration: 195 mins.

SECTION - I
Answer all the questions. Section Duration: 40 mins

1 Which of the following is responsible for generating anintermediate representation of the source
program?
(1)
Syntax Semantic Code Intermediate code
1) 2) 3) 4)
analyzer analyzer generator generator

2 Which phase of a language processor is responsible for syntaxanalysis and error detection?

Lexical Semantic Code Syntax (1)


1) 2) 3) 4)
analysis analysis optimization analysis

3 What is the primary role of the semantic analyzer in a languageprocessor?

Error Symbol table Type (1)


1) 2) 3) Tokenization 4)
detection generation checking

4 Which phase of the language processor is responsible for convertingthe intermediate code into the
target machine code?
(1)
Code Code Lexical Syntax
1) 2) 3) 4)
optimization generator analysis analysis

5 What is the primary purpose of a symbol table in a languageprocessor?

Error Intermediate code Memory Symbol (1)


1) 2) 3) 4)
detection generation management management

6 Which phase of the language processor performs code transformationsto improve its quality without
changing its functionality?
(1)
Lexical Syntax Code Semantic
1) 2) 3) 4)
analysis analysis optimization analysis

7 What does the syntax analyzer ensure in a language processor?

Compliance with Appropriate (1)


Consistency in Code
1) 2) 3) language grammar 4) use of
variable naming efficiency
rules comments

8 Which of the following generates a syntax tree or an abstractsyntax tree (AST) in a language
processor?
(1)
Code Lexical Semantic
1) 2) Parser 3) 4)
generator analyzer analyzer

9 Which phase of a language processor involves the creation andmanagement of temporary variables and
addresses?
(1)
Code Lexical Semantic Code
1) generation 2) analysis 3) analysis 4) optimization

10 What is the primary function of the intermediate code in a languageprocessor?

Direct Providing a link between (1)


Code Error
1) execution on 2) 3) the source code and the 4)
optimization detection
the CPU target code

11 What is the role of the error recovery module in a languageprocessor?

Ignoring Reporting Handling errors Avoiding (1)


1) 2) 3) 4)
errors errors gracefully errors

12 Which phase of a language processor is responsible for identifyingand resolving references to variables
and their correspondingmemory locations?
(1)
Semantic Code Code Syntax
1) 2) 3) 4)
analysis optimization generation analysis

13 Match all items in Group 1 with correct options from those given inGroup 2.

Group 1 Group 2
P. Regular expression 1. Syntax analysis
Q. Pushdown automata 2. Code generation
(1)
R. Dataflow analysis 3. Lexical analysis
S. Register allocation 4. Code optimization

P-4. Q-1, R-2, P-3, Q-1, R-4, P-3, Q-4, R-1, P-2, Q-1, R-4,
1) 2) 3) 4)
S-3 S-2 S-2 S-3

14 An LALR(1) parser for a grammar G can have shift-reduce (S-R)conflicts if and only if

the SLR(1) the LR(1) the LR(0) the LALR(1)


parser for G parser for G parser for G parser for G has (1)
1) 2) 3) 4)
has S-R has S-R has S-R reduce-reduce
conflicts conflicts conflicts conflicts

15 Assume that the SLR parser for a grammar G has n1 states and theLALR parser for G has n2 states.
The relationship between n1 and n2is:

none (1)
n1 is necessarily n1 is necessarily n1 is necessarily
1) 2) 3) 4) of
less than n2 equal to n2 greater than n2
these

16 In a bottom-up evaluation of a syntax directed definition,inherited attributes can

always be evaluated only be evaluated only if the (1)


never be
1) be 2) if the definition is 3) definition has 4)
evaluated
evaluated L-​attributed synthesized attributes

17 The number of tokens in the following C statement is printf("i=%d,&i=%x", i,&i);


(1)
1) 13 2) 11 3) 10 4) 9

18 Which one from the following is false?

LR
In LL(1), the 1
LALR A parsing algorithm which parser
indicates that (1)
parser is performs a left to right is
1) 2) 3) 4) there is a one -
Bottom - scanning and a right most Bottom -
symbol look -
Up parser deviation is RL (1) Up
ahead.
parser.

19 In the context of abstract-syntax-tree (AST) and control-flow-graph(CFG), which one of the following is
True?

The Each node


In both AST and CFG, let For any maximum in AST and
node N2 be the input number of CFG
(1)
successor of node N1. In program, successors of corresponds
1) the input program, the 2) neither 3) a node in an 4) to at most
code corresponding to AST nor AST and a one
N2 is present after the CFG will CFG depends statement in
code corresponding to contain a on the input the input
N1 cycle program program

20 Match the following:

List-I List-II
A. Lexical analysis 1. Graph coloring
B. Parsing 2. DFA minimization
C. Register allocation 3. Post-order traversal
D. Expression evaluation 4. Production tree

(1)
Codes:
ABCD
(a) 2 3 1 4
(b) 2 1 4 3
(c) 2 4 1 3
(d) 2 3 4 1

1) a 2) b 3) c 4) d
SECTION - II
Answer 5 out of 7 questions.

1 Define symbol table and outline the purposes for which a compilerutilizes it. (4)

2 Determine the First and Follow sets for the provided grammar.
S → AaB | bC
A → cD | ε
B→e|ε (4)
C→f|ε
D→g|ε

3 Explain the various issues in the design of a code generator. (4)

4 Define lexical analysis and enumerate the tasks carried out by alexical analyzer. (4)

5 Construction of Non-recursive Predictive Parsing Table. (4)

6 Describe the process of handling syntax errors. (4)

7 Describe Basic-Block Scheduling. (4)

SECTION - III
Answer 6 out of 8 questions.

1 Give the rule to remove left recursive grammar. And Eliminate leftrecursion from following grammar.
S → Aa | b (5)
A → Ac | Sd | f

2 Provide an explanation of synthesized attributes, supported by anillustrative example. (5)

3 Construct CLR parsing table for following grammar.


S -> aSA | € (5)
A -> bS | c

4 Discuss about S-attributed and L-attributed SDT with example. (5)


5 Show the following grammar is LR(1) but not LALR(1).
S->Aa │bAc │Bc│bBa
A->d (5)
B->d

6 Provide an explanation of the input, output, and actions carriedout by each phase of the compiler,
accompanied by an example. (5)

7 Define peephole optimization and illustrate it with an example. (5)

8 Describe three address code generators with example. (5)

-----End-----

You might also like