Q1: 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.
(A) LR parser
(B) RL parser
(C) BU parser
(D) None of the given
Answer: (A) LR parser
Q2: Yacc contains built-in support for handling ambiguous grammars resulting in shift-reduce conflicts. By default these conflicts are solved by performing the ___.
(A) Shift action
(B) Reduce action
(C) Shift and reduce actions
(D) De-allocation of memory
Q5: When generating a lexical analyzer from a ___ description, the item sets (states) are constructed by two types of âmovesâ: character moves and Δ-moves.
(A) Character
(B) Token (Page 18)
(C) Grammar
(D) Sentence
Answer: (B) Token
Q6: Left factoring is enough to make a grammar LL(1).
(A) True
(B) False
Answer: (B) False
Q8: Grammars with LL(1) conflicts can be made LL(1) by applying left-factoring, substitution, and left-recursion removal. Left-factoring takes care of ___ conflicts.
(A) FIRST/FIRST
(B) FIRST/SECOND
(C) SECOND/FIRST
(D) None of the given
Answer: (A) FIRST/FIRST
Q9: Alternative of the backtrack in parser is Look ahead symbol in ___.
(A) Input (Page 46)
(B) Output
(C) Input and Output
(D) None of the given
Answer: (A) Input
Q10: Typical compilation means programs written in high-level languages to low-level ___.
(A) Object code (Page 2)
(B) Byte code
(C) Unicode
(D) Both Object Code and Byte code
Answer: (A) Object code
Q11: In PASCAL, ___ represent the inequality test.
(A) :
(B) :=
(C) =
(D) <>
Answer: (D) <>
Q12: LR parsing ___ a string to the start symbol by inverting productions.
(A) Reduces (Page 63)
(B) Shifts
(C) Adds
(D) None of the given
Answer: (A) Reduces
Q13: In parser, the two LL stand for ___.
(A) Left-to-right scan of input
(B) Left-most derivation
(C) All of the given (Page 47)
(D) None of the given
Answer: (C) All of the given
Q14: Parser always gives a tree-like structure as output.
(A) True (Page 37)
(B) False
Answer: (A) True
Q15: Lexer and scanner are two different phases of compiler.
(A) True
(B) False (Page 12)
Answer: (B) False
Q16: In compilation process, Hierarchical analysis is also called ___.
(A) Parsing
(B) Syntax analysis
(C) Both Parsing and Syntax analysis
(D) None of given
Answer: (C) Both Parsing and Syntax analysis
Q17: Ambiguity can easily be handled by Top-down Parser.
(A) True
(B) False
Answer: (B) False
Q18: Front-end of a two-pass compiler consists of Scanner.
(A) True (Page 5)
(B) False
Answer: (A) True
Q19: LL(1) parsing is called non-predictive parsing.
(A) True
(B) False
Answer: (B) False
Q20: In predictive parsing table, the rows are ___.
(A) Non-terminals (Page 54)
(B) Terminals
(C) Both non-terminal and terminals
(D) None of the given
Answer: (A) Non-terminals
Q21: In LL(1) parsing algorithm, ___ contains a sequence of grammar symbols.
(A) Stack (Page 55)
(B) Link list
(C) Array
(D) None
Answer: (A) Stack
Q22: Grammar:
A –> B C D
B –> h B | Δ
C –> C g | g | C h | i
D –> A B | Δ
First of C is ___.
(A) h
(B) g, i
(C) g, h, i, $
(D) g
Answer: (B) g, i
Q23: AST summarizes the grammatical structure without the details of derivations.
(A) True
(B) False (Page 8)
Answer: (B) False
Q24: Left factoring is enough to make LL(1) grammar.
(A) True
(B) False
Answer: (B) False
Q25: A grammar is LR if a ___ parser can recognize handles when they appear on the top of the stack.
(A) left-to-reverse
(B) left-to-rise
(C) left-to-right
(D) None of the given
Answer: (C) left-to-right
Q26: 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.
(A) Terminal
(B) Non-terminal
Answer: (B) Non-terminal
Q27: The regular expressions a*|b* and (a|b)* describe the ___ set of strings.
(A) Same
(B) Different
(C) Onto
Answer: (B) Different
Q28: Yacc contains built-in support for handling ambiguous grammars resulting in ___ conflicts.
(A) Shift-reduce
(B) Shift-Shift
(C) Shift-second
(D) None of the given
Answer: (A) Shift-reduce
Q29: A lexical analyzer generator automatically constructs a ___ that recognizes tokens.
(A) FA (Page 18)
(B) PDA
(C) DP
(D) None of the given
Answer: (A) FA
Q30: Two items A â P âą Q and B â P âą Q can co-exist in an ___ item set.
(A) LR
(B) LS
(C) LT
(D) PR
Answer: (A) LR
Q31: LR parsers can handle ___ grammars.
(A) Left-recursive (Page 63)
(B) File-recursive
(C) End-recursive
(D) Start-recursive
Answer: (A) Left-recursive
Q32: ___ convert the reloadable machine code into absolute machine code by linking library and reloadable object files.
(A) Assembler
(B) Loader/link-editor
(C) Compiler
(D) Preprocessor
Answer: (B) Loader/link-editor
Q33: One of the core tasks of compiler is to generate fast and compact executable code.
(A) True (Page 2)
(B) False
Answer: (A) True
Q34: Compilers are sometimes classified as:
(A) Single pass
(B) Multi pass
(C) Load and go
(D) All of the given
Answer: (D) All of the given
Q35: Regular Languages are easy to understand, based on simple theory, and popular for specifying tokens.
(A) All of the given (Page 15)
Answer: (A) All of the given
Q36: The transition graph for an NFA that recognizes the language (a|b)*abb will have following set of states.
(A) {0}
(B) {0,1}
(C) {0,1,2}
(D) {0,1,2,3}
Answer: (D) {0,1,2,3}
Q37: Functions of Lexical analyzer include removing white space, constants, identifiers, keywords, and comments.
(A) All of the given
Answer: (A) All of the given
Q38: Flex is an automated tool that is used to get the minimized DFA (scanner).
(A) True
(B) False (Page 26)
Answer: (A) True
Q39: We use ___ to mark the bottom of the stack and the right end of the input in Shift-Reduce Parsing.
(A) Epsilon
(B) #
(C) $
(D) None of the given
Answer: (C) $
Q40: When generating a lexical analyzer from a token description, the item sets (states) are constructed by two types of moves: character moves and ___ moves.
(A) Δ (Page 18)
(B) #
(C) @
(D) None of given
Answer: (A) Δ
Q41: Bottom-up parsers handle a ___ class of grammars.
(A) Large (Page 42)
(B) Small
(C) Medium
(D) None of the given
Answer: (A) Large
Q42: Parser takes tokens from scanner and tries to generate ___.
(A) Binary Search tree
(B) Parse tree
(C) Syntax tree (Page 8)
(D) None of the given
Answer: (C) Syntax tree
Q43: In Flex specification file, different sections are separated by ___.
(A) %% (Page 26)
(B) &&
(C) ##
(D) \
Answer: (A) %%
Q44: In DFA minimization, we construct one ___ for each group of states from the initial DFA.
(A) State (Page 25)
(B) NFA
(C) PDA
(D) None of given
Answer: (A) State
Q45: Grammar:
A –> B C D
B –> h B | Δ
C –> C g | g | C h | i
D –> A B | Δ
Follow of B is ___.
(A) h
(B) g, h, i, $
(C) g, i
(D) g
Answer: (B) g, h, i, $
Q46: Follow of C is ___.
(A) g, h, i, $ (Page 47)
(B) g, h, $
(C) h, i, $
(D) h, g, $
Answer: (A) g, h, i, $
Q47: An important component of semantic analysis is ___.
(A) Code checking
(B) Type checking (Page 6)
(C) Flush checking
(D) None of the given
Answer: (B) Type checking
Q48: Intermediate Representation (IR) stores the value of its operand in ___.
(A) Registers
(B) Memory
(C) Hard disk
(D) Secondary storage
Answer: (A) Registers
Q49: ___ algorithm is used in DFA minimization.
(A) Jamesâs
(B) Robertâs
(C) Hopcroftâs (Page 25)
(D) None of given
Answer: (C) Hopcroftâs
Q50: ___ is a top-down parser.
(A) Predictive Parsing (Page 46)
(B) Reactive parser
(C) Proactive parser
(D) None of the given
Answer: (A) Predictive Parsing
Q51: Lexical Analyzer generator ___ is written in Java.
(A) Flex
(B) JLex (Page 26)
(C) Complex
(D) None of given
Answer: (B) JLex
Q52: ___ avoid hardware stalls and interlocks.
(A) Register allocation
(B) Instruction scheduling (Page 10)
(C) Instruction selection
(D) None of given
Answer: (B) Instruction scheduling
Q53: Recursive ___ parsing is done for LL(1) grammar.
(A) Decent (Page 47)
(B) Ascent
(C) Forward
(D) Backward
Answer: (A) Decent
Q54: Left factoring of a grammar is done to save the parser from backtracking.
(A) True (Page 61)
(B) False
Answer: (A) True
Q55: Responsibility of ___ is to produce fast and compact code.
(A) Instruction selection (Page 9)
(B) Register allocation
(C) Instruction scheduling
(D) None of given
Answer: (A) Instruction selection
Q56: Optimal register allocation is an NP-hard problem.
(A) True (Page 10)
(B) False
Answer: (A) True
Q57: Front-end of two-pass compiler takes ___ as input.
(A) Source code (Page 5)
(B) Intermediate Representation (IR)
(C) Machine Code
(D) None of the given
Answer: (A) Source code
Q58: In Three-pass compiler, ___ is used for code improvement or optimization.
(A) Front End
(B) Middle End (Page 10)
(C) Back End
(D) Both Front End and Back End
Answer: (B) Middle End
Q59: ___ of a two-pass compiler consists of Instruction selection, Register allocation, and Instruction scheduling.
(A) Back End (Page 9)
(B) Front End
(C) Start
(D) None of given
Answer: (A) Back End
Q60: NFA is easy to implement as compared to DFA.
(A) True
(B) False (Page 19)
Answer: (A) True
Q61: In Back End module of compiler, optimal register allocation uses ___.
(A) O(log n)
(B) O(n log n)
(C) NP-Complete (Page 10)
(D) None of the given
Answer: (C) NP-Complete
Q62: In a transition table, cells of the table contain the ___.
(A) Reject state
(B) Next state (Page 18)
(C) Previous state
(D) None of the given
Answer: (B) Next state
Q63: Can a DFA simulate NFA?
(A) Yes
(B) No
(C) Sometimes
(D) Depend upon NFA
Answer: (A) Yes
Q64: Phase which supports macro substitution and conditional compilation.
(A) Syntax
(B) Semantic
(C) Preprocessing
(D) None
Answer: (C) Preprocessing
Q65: In multi-pass compiler, during the first pass it gathers information about ___.
(A) Declarations
(B) Bindings
(C) Static information
(D) None
Answer: (A) Declarations
Q66: Parser takes tokens from scanner and tries to generate ___.
(A) Binary Search tree
(B) Parse tree
(C) Syntax trace
(D) None of the given
Answer: (B) Parse tree
Q67: Grammar:
S –> A | xb
A –> aAb | x
This grammar contains a reduce-reduce conflict.
(A) True
(B) False
Answer: (A) True
Q68: Three-address codes are often implemented as a ___.
(A) Set of quadruples
Answer: (A) Set of quadruples