Skip to main content

CS606 Current Final Term Fall 2013 Shared by Mahi_Naveed File 1



1.         S --> a | B
B --> Bb | E
The non-terminal _______ is left recursive.
Answer: B

2.         When constructing an LR(1) parser we record for each item exactly in which context it appears, which resolves
many conflicts present in _______parsers based on FOLLOW sets.
Select correct option:
1. SLR(1)
2. LRS(1)
3. RLS(1)
4. None of the given

3.         When generating a lexical analyzer from a token description, the item sets (states) are constructed by two types
of “moves”: character moves and ____ moves.
Select correct option:
1. E (empty string) Page no : 18
2. #
3. @
4. none of given

4.         When generating a lexical analyzer from a ____ description, the item sets (states) are constructed by two types
of “moves”: character moves and E moves.
Select correct option:
1. token
2. character
3. grammer
4. none of given

5.         S --> A | xb
A --> aAb | x
This grammar contains a ____conflict.
Select correct option:
Reduce-reduce
shift-reduce
shift-shift
none of the given

6.         Yacc contains built-in support for handling ambiguous grammars resulting in _______ conflicts.
Select correct option:
Shift-reduce
Shift-Shift
Shift-second
None of the given

7.         Attributes whose values are defined in terms of a node’s own attributes, node’s siblings and node’s parent are
called __________ .
Select correct option:
Inherited attributes Page no : 92
Physical attributes
Logical attributes
Un-synthesized attributes

8.         Register allocation by graph coloring uses a register interference graph. _________ nodes in the graph are
joined by an edge when the live ranges of the values they represent overlap.
Select correct option:
Two page no : 136
Three
Four

9.         The following two items
A -> P • Q
B -> P • Q
can co-exist in an ______ item set.
Select correct option:
LR
LS
LT
PR

10.       Three-address codes are often implemented as a ________.
Select correct option:
Set of quadruples Page no : 104

11.       Attributes of a node whose values are defined wholly in terms of attributes of node’s children and from
constants are called ________.
Synthesized attributes Page no : 92

12.       What does following statement represent? x[i] = y
Answer: indexed assignment Page no : 107

13.       S --> A B
A --> e | aA
B --> e | bB - FIRST(S) contains ___ elements
Answer: 3 Page no : 46
First{S}={e,a,b}

14.       Dotted items (Ta •b) record which part of a token has already been matched. Integer? ([0-9])+ • This
is a _____ item.
Answer: Extended Page no : 73

15.       ____________tree in which each node represents an operator and children of the node represent the operands.
Select correct option:
Abstract syntax Page no : 100
Concrete syntax
Parse
None of the given

16.       Ambiguity can easily be handled by _____Parser
Select correct option:
Top-down
Bottom-up
Left recursive
Predictive

17.       In PASCAL ___________ represent the inequality test.
:=
=
<> 
None of the given

18.       Responsibility of ______________ is to produce fast and compact code.
Instruction selection
Register allocation
Instruction scheduling
None of given

19.       Parser takes tokens from scanner and tries to generate _______________ .
Binary Search tree
Parse tree
Syntax trace Page no : 6
None of the given

20.       In Back End module of compiler, optimal register allocation uses_______________ .
O(log n)
O(n log n)
N P-Complete Page no : 10
None of the given

21.       ____ summarizes the grammatical structure with the details of derivations.
Select correct option:
AST
SAT
LPAR
LL(1)

22.       Typical compilation means programs written in high-level languages to
low-level ____________.
Select correct option:
Object code
Byted code
Unicode
Both Object Code and byte code

23.       A linker takes one or more source files generated by a compiler and combines them into a ______ executable program.
Single
Double
Triple
Quadruples

Baki 2 mcqs Yacc me se aye thy aur shift-reduce k bht ziada mcqs thy
aur yaad nae hain L

Subjective questions

1.                  What are two properties of reducible flow graphs?
2.                  Which Information we can get the third section of YACC file.
3.                   

Traverse the given tree in postorder.
4.                  What are the characteristics of live variable?
5.                  Define the structure of common table of LR(1).
6.                  Define Intermediate representation which is closest to hardware and what is its main function?
7.                  When we use garbage collection with respect to memory management?
8.                  x:=(a-b)*(c+d)
write 3-address code of the given expression. (5 marks).
9.                  1question 5 marks ka block code likhna tha wo yad nae
10.             Intermediate code dia tha simple code generate krna tha (5 marks)

Sorry baki yaad nae hain


Comments