Q#1: The input specification file to Flex consists of ____ sections.
(A) One
(B) Two
(C) Three
(D) Four
Answer: (C) Three
Q#2: Lexer and scanner are two different phases of compiler.
(A) True
(B) False
Answer: (B) False
Q#3: In compiler, linear analysis is also called _____.
(A) Lexical analysis
(B) Scanning
(C) Both lexical analysis and scanning
(D) None of the given
Answer: (C) Both lexical analysis and scanning
Q#4: Which of the following statements is not true?
(A) The language accepted by finite automata is the language denoted by regular expressions.
(B) For every DFA there is a regular expression denoting its language.
(C) For a regular expression r, there does not exist NFA with L(r) any transit that accepts.
(D) None of the given option
Answer: (C) For a regular expression r, there does not exist NFA with L(r) any transit that accepts.
Q#5: Consider the grammar:
A → B C D
B → h B | ε
C → C g | g | C h | i
D → A B | ε
First of A is:
(A) h, g, i
(B) g
(C) h
(D) None of the given option
Answer: (A) h, g, i
Q#6: Top-down parsing expands a ____ from the start symbol to the leaves.
(A) Parse tree
(B) Abstract syntax tree
(C) Parse tree
(D) All of the given
Answer: (D) All of the given
Q#7: A top-down parser starts with the ____ of the parse tree.
(A) Root
(B) Leaf
(C) Middle
(D) None of the given
Answer: (A) Root
Q#8: Can a DFA simulate NFA?
(A) No
(B) Yes
(C) Sometimes
(D) Depends on NFA
Answer: (B) Yes
Q#9: Bottom-up parsing is also called _____.
(A) LR parsing
(B) LT parsing
(C) LS parsing
(D) SS parsing
Answer: (A) LR parsing
Q#10: The ____ is optimized for the hardware it is to run on.
(A) C++ code
(B) C code
(C) Assembly code
(D) None
Answer: (C) Assembly code
Q#11: Abstract Syntax Tree summarizes ____ without the detail of derivation.
(A) Theory
(B) Grammatical structure
(C) Data
(D) None
Answer: (B) Grammatical structure
Q#12: LR parsing ____ a string to the start symbol by inverting productions.
(A) Reduces
(B) Shifts
(C) Adds
(D) None of the given
Answer: (A) Reduces
Q#13: Alternative to backtrack in top-down parser is _____.
(A) Context free grammar
(B) Tree
(C) Look ahead
(D) None of the given
Answer: (C) Look ahead
Q#14: Typical compilation means programs written in high-level languages to low-level _____.
(A) Object code
(B) Byte code
(C) Unicode
(D) Both object and byte code
Answer: (A) Object code
Q#15: The ____ checks the stream of words and their parts of speech for grammatical correctness.
(A) Parser
(B) Scanner
(C) Compiler
(D) None of the given
Answer: (C) Compiler
Q#16: A grammar must be ____ before use for predictive parsing.
(A) Right factored
(B) Left factored
(C) Factored
(D) None of the given
Answer: (B) Left factored
Q#17: Parser does not distinguish between valid and invalid sequences of tokens.
(A) True
(B) False
Answer: (B) False
Q#18: In compilation process, hierarchical analysis is also called _____.
(A) Parsing
(B) Syntax analysis
(C) Both Parsing and Syntax analysis
(D) None of given
Answer: (B) Syntax analysis
Q#19: The pair <role, word> is given the name _____.
(A) Word
(B) Token
(C) Syntax
(D) None of the given
Answer: (B) Token
Q#20: The back-end maps Intermediate Representation (IR) into target _____.
(A) Object code
(B) Machine code
(C) Source code
(D) Linker
Answer: (B) Machine code
Q#21: ____ is evaluated to yield a value.
(A) Command
(B) Expression
(C) Declaration
(D) Declaration and Command
Answer: (B) Expression
Q#22: Front end of a two-pass compiler consists of scanner.
(A) True
(B) False
Answer: (A) True
Q#23: The ____ returns a sequence of matching tokens at the output and always returns the longest matching token.
(A) Scanner
(B) Lexer
(C) Lexical analysis
(D) All of the given
Answer: (D) All of the given
Q#24: 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
Q#25: ____ avoids hardware stalls and interlocks.
(A) Register allocation
(B) Instruction scheduling
(C) Instruction selection
(D) None of the given
Answer: (B) Instruction scheduling
Q#26: The handle-finding mechanism is the key to efficient parsing.
(A) Top-down
(B) Bottom-up
(C) Predictive
(D) None of the given
Answer: (B) Bottom-up