Cs606 Midterm Solved MCQ by Sadaf Awan
Cs606 Midterm Solved MCQ by Sadaf Awan
Cs606 Midterm Solved MCQ by Sadaf Awan
Midterm MCQ
By Sadaf Awan
BSCS
1: An ----- does not need to examine the entire stack for a handle, the state symbol on the top
of the stack contains all the information it needs
LR parser
RL parser
BU parser
None of the giv
2: 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
3: S --> A | xb
A --> aAb | x
This grammar contains a reduce-reduce conflict
True
False
4: S --> a | B
B --> Bb | E
The non-terminal _______ is left recursive.
B
A
E
None of the given
5: 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
7: S --> A B
A --> e | aA
B --> e | bB
FIRST(S) contains ___ elements.
3
4
5
6
16: Ambiguity can easily be handled by Top-down Parser Select correct option:
True Click here 4 details
False
22: AST summarizes the grammatical structure with the details of derivations.
True
False (Page 8)
24: A grammar is LR if a ------ shift reduce-reduce parser can recognize handles when they
appear on the top of stack.
left-to-reverse
left-to-rise
left-to-right Click here for detail
None of the given
25: Reduction of a handle to the ------- on the left hand side of the grammar rule is a step
along the reverse of a right most derivation.
Terminal
Non-terminal
26: The regular expressions a*|b* and (a|b)* describe the _____set of strings.
Same
Different
Onto
27: Yacc contains built-in support for handling ambiguous grammars resulting in _______
conflicts.
Shift-reduce
Shift-Shift
Shift-second
None of the given
28: A lexical analyzer generator automatically constructs a _____ that recognizes tokens.
FA (Page 18)
PDA
DP
None of the given
29: The following two items A -> P • Q B -> P • Q can co-exist in an ______ item set.
LR
LS
LT
PR
31: _____ convert the reloadable machine code into absolute machine code by linking
library and reloadable object files.
Assembler
Loader/link-editor
Compiler
Preprocessor
32: One of the core tasks of compiler is to generate fast and compact executable code.
True (Page 2)
False
35: The transition graph for an NFA that recognizes the language ( a | b)*abb will have
following set of states.
{0}
{0,1}
{0,1,2}
{0,1,2,3}
36: Functions of Lexical analyzer are?
Removing white space
Removing constants, identifiers and keywords
Removing comments
All of the given
37: Flex is an automated tool that is used to get the minimized DFA (scanner).
True
False (Page 26)
38: We use ----- to mark the bottom of the stack and also the right end of the input when
considering the Stack implementation of Shift-Reduce Parsing.
1. Epsilon
2. #
3. $ Click here for detail
4. None of the given
39: When generating a lexical analyzer from a token description, the item sets (states) are
constructed by two types of “moves”: character moves and ____ moves.
1. E Click here for detail
2. #
3. @
4. none of given
41: Parser takes tokens from scanner and tries to generate _______________ .
Binary Search tree
Parse tree
Syntax tree (Page 8)
None of the given
53: Left factoring of a grammar is done to save the parser from back tracking.
True (Page 61)
False
61: In a transition table cells of the table contain the ________ state.
Reject state
Next state (Page 18)
Previous state
None of the given
64:In multi pass compiler during the first pass it gathers information about
___________________ .
Declarations
Bindings
Static information
None
65:Parser takes tokens from scanner and tries to generate_______________ .
Select correct option:
Binary Search tree
Parse tree
Syntax trace
None of the given
66: S --> A | xb
A --> aAb | x This grammar contains a reduce-reduce conflict.
If a DFA states contains both [X → α •, a] and [Y → β •, a], then on input “a” we don’t
know which production to reduce with. This is called a reduce-reduce conflict. Usually
due to gross ambiguity in the grammar.
True
False
70: The error handling mechanism of the yacc parser generator pushes the input
stream back when inserting ‘missing’ tokens.
True
False
71: What does the following statement represent? goto L
Unconditional jump
Copy statement
Conditional jump
Conditional jump
While loop