CS606 Current FinalTerm Paper 22 August 2016



CS606 Current FinalTerm Paper 22 August 2016


Total Questions = 52
Total Marks = 80
Total 1 Mark MCQ = 40
Total 2 Marks Short Questions = 4
Total 3 Marks Short Questions = 4
Total 5 Marks Long Questions = 4

Complete paper
Paper was very easy and short mostly from Past papers.

MCQ 30 – 35 from Past papers

1)
The regular expressions a*|b* and (a|b)* describe the _____set of strings.
Same
Different
Onto

2)    This MCQ was asked 2 times in the paper
S --> a | B
B --> Bb | E The non-terminal _______ is left recursive.
Answer: B     
3)
A lexical analyzer generator automatically constructs a _____ that recognizes tokens.
Select correct option:
FA
PDA
DP
None of the given

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

5)
Three-address codes are often implemented as a ________.
Select correct option:
Set of quadruples Page no: 104
6)
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
7)
The notation _______ instructs YACC to push a computed attribute value on the stack.
Select correct option:
Answer: $$ Page no: 98
8)
What does following statement represent? x[i] = y
Answer: indexed assignment Page no: 107
9)
S --> A B
A --> e | aA
B --> e | bB - FIRST(S) contains ___ elements
Answer: 3 Page no: 46
First{S} = {e,a,b}
10)
Dotted items (Ta •b) record which part of a token has already been matched. Integer ? ([0-9])+ • this is a _____ item.
Answer: Reduced
11)
A _______ is a top down parser.
Answer: Predictive Parsing Page no: 46

12)
Intermediate Representation (IR) stores the value of its operand in _____________________ .
Select correct option:
Registers Page no: 10
Memory
Hard disk
Secondary storage
13)
In compilation process Hierarchical analysis is also called
Select correct option:
Parsing
Syntax analysis
Both Parsing and Syntax analysis
None of given
14)
Consider the grammar A --> B C D
B --> h B | epsilon
C --> C g | g | C h | i
D --> A B | epsilon
Follow of C is _____________ .
h
g, h, i, $
g, i
g
15)
In PASCAL ___________ represent the inequality test.
:=
=
<> 
None of the given
16)
In DFA minimization we construct one _______________ for each group of states from the initial DFA.
State Page no: 25
NFA
PDA
None of given
17)
Intermediate Representation (IR) stores the value of its operand in
Registers
Memory
Hard disk
Secondary storage
18)
Yacc contains built-in support for handling ambiguous grammars resulting in shift-reduce conflicts. By default these conflicts are solved by performing the ________.
 Shift action
 Reduce action
Shift and reduce actions
 De-allocation of memory

19)
When generating a lexical analyzer from a ________ description, the item sets (states) are constructed by two types of “moves”: character moves and e moves.

Character
Grammar
Token (Page 18)
 Sentence


20)
The notation _______ instructs YACC to push a computed attribute value on the stack.
$$ (Page 98)
 &&
## --

21)
Performing common sub expression elimination on a dependency graph requires the identification of nodes with the same operator and operands. When using a hash table (with a hash function based on operator and operands) all________ nodes can be identified in linear time.
Common
Uncommon
Next
Previous
22)
Linear IRs resembles pseudo-code for same ___________.
Automated Machine
Mechanical machines
Token machines
Abstract machine (Page 100)
23)
A lexical analyzer generator automatically constructs a _____ that recognizes tokens.
FA (Page 18)
PDA
DP
None of the given
24)
The following two items A -> P • Q B -> P • Q can co-exist in an ______ item set.
LR
LS
LT
PR
25)
Simple code generation considers one AST node at a time. If the target is a register machine, the code can be generated in one _____ traversal of the AST, possibly introducing temporaries when running out of registers.
Select correct option:Depth-first Breadth-first Top-Down Bottom-Up
Select correct option:
Depth-first
Breadth-first
Top-Down
Bottom-Up


26)
Simple code generation considers one AST node at a time. If the target is a stack machine, the code can be generated in one _____ traversal of the AST, possibly introducing temporaries when running out of registers.

27)
In compilers, linear analysis is also called _____________
a. Lexical Analysis
b. Scanning
c. Lexical Analysis and Scanning
d. None of the given

28)

The parser generator YACC can handle _______________ grammar.
a. LL(1)
b. LT(1)
c. LS(1)
d. LF(1)

29)

A linker combines multiple object files into a __________ executable object.

a. Single
b. Double
c. Triple
d. Quadruple

30)

Hybrid IRs combine elements of _________

a. Graphical (Structural)
b. Linear IRs
c. Both Graphical (Structural) and linear
d. Non-Linear IRs


Subjective Part
A code statement was given have to identify LR (1) or LL (1) (2marks)
Qs Was given tell the example of ……. Transformation (2marks)
Traverse the given tree in postorder. (2marks)

 

Why compiler uses multiple instruction representation? 3 Marks
Which information we can get from the first section of YACC file? (3 Marks)
Differentiate attribute grammar and syntax-directed grammar. (3marks)
What is reducible flow graph? (3 marks)
Add semantic rules to the following grammar to compute the attribute rm, whose value is the rightmost
terminal in the string we parsed. For example, if the string parsed were zxyxy, S.rm would be y.
                                                                                           (5marks)


A grammar was given we have to find First and Follow (5 marks)
An expression was given we have to draw syntax tree. (5marks)
Role of GOTO and Label (5 marks)


Welcome to Our WebSite! - | LMS Help | Pakistan NO # 1 . Website for the Students of Virtual University.

Next
Previous
Click here for Comments

0 comments: