CS606 – Compiler Construction: Midterm Important MCQs (109 Solved Questions)
Computer Science • Read every solved MCQ with its verified answer key directly on this page. Free, no login required.
All 664 Midterm Packs · CS606 Course Page · CS606 Subjective Pack (26 Q&As)
-
Parser takes tokens from scanner and tries to generate _______________
Topic: Core Midterm Concepts
- Binary Search tree
- Parse tree ✓ Correct answer
- Syntax trace
- None of the given
-
Typical compilation means programs written in high-level languages to low-level ________.
Topic: Core Midterm Concepts
- Object code ✓ Correct answer
- Byte code
- Unicode
- Object Code and byte code
-
In compilation process, Hierarchical analysis is also called ____________.
Topic: Core Midterm Concepts
- Parsing
- Syntax
- Parsing and Syntax analysis ✓ Correct answer
- None of given
-
_____________is evaluated to yield a value.
Topic: Core Midterm Concepts
- Command
- Expression ✓ Correct answer
- Declaration
- Declaration and Command
-
In Flex specification file different sections are separated by ___________________
Topic: Core Midterm Concepts
- %% ✓ Correct answer
- &&
- ##
- \\
-
In DFA minimization, we construct one ____________ for each group of states from the initial DFA.
Topic: Core Midterm Concepts
- State ✓ Correct answer
- NFA
- PDA
- None of given
-
Recursive ________ parsing is done for LL(1) grammar.
Topic: Core Midterm Concepts
- Descent ✓ Correct answer
- Ascent
- Forward
- None of the given
-
In compilers, linear analysis is also called _______.
Topic: Core Midterm Concepts
- Lexical analysis
- Scanning
- Lexical analysis and scanning ✓ Correct answer
- None of the given
-
The Back End of a compiler consist of ______________
Topic: Core Midterm Concepts
- Instruction selection ✓ Correct answer
- Register allocation
- Instruction scheduling
- All of the given
-
In Back End module of compiler, optimal register allocation uses ___________.
Topic: Core Midterm Concepts
- O(log n)
- O(n log n)
- NP-Complete ✓ Correct answer
- None of the given
-
_________algorithm is used in DFA minimization.
Topic: Core Midterm Concepts
- James's
- Robert's
- Hopcroft’s ✓ Correct answer
- None of given
-
An important component of semantic analysis is __________________
Topic: Core Midterm Concepts
- code checking
- type checking ✓ Correct answer
- flush checking
- None of the given
-
In predictive parsing table, the rows represents __________.
Topic: Core Midterm Concepts
- Terminals
- Both non-terminal and terminals
- Non-terminals ✓ Correct answer
- None of the given
-
Back End of two-pass compiler uses _______ algorithm.
Topic: Core Midterm Concepts
- O(n)
- O(n log n)
- NP Complete ✓ Correct answer
- None of the Given
-
In multi pass compiler, during the first pass it gathers information about ____________.
Topic: Core Midterm Concepts
- Declaration ✓ Correct answer
- Bindings
- Static information
- None of the given
-
Lexical Analyzer generator ________________ is written in Java.
Topic: Core Midterm Concepts
- Flex
- Jlex ✓ Correct answer
- Complex
- None of given
-
Alternative of the backtrack in parser is Look ahead symbol in _________
Topic: Core Midterm Concepts
- Input ✓ Correct answer
- Output
- Input and Output
- None of the given
-
Bottom-up parsing uses only _______________ kinds of actions.
Topic: Core Midterm Concepts
- Two ✓ Correct answer
- Three
- Four
- Five
-
In _____certain checks are performed to ensure that components of a program fit together meaningfully.
Topic: Core Midterm Concepts
- Linear analysis
- Hierarchical analysis
- Semantic analysis ✓ Correct answer
- None of given
-
_________ of a two-pass compiler is consists of Instruction selection, Register allocation and Instruction scheduling.
Topic: Core Midterm Concepts
- Backend ✓ Correct answer
- Frontend
- Start
- None of the Given
-
Bottom-up parsers handle a _______________ class of grammars.
Topic: Core Midterm Concepts
- Large ✓ Correct answer
- Small
- Medium
- None of the given
-
A lexeme is a sequence of characters in the source program that is matched by the pattern for a __________.
Topic: Core Midterm Concepts
- Linker
- Token ✓ Correct answer
- Control flow
- None of given
-
What kind of abstract machine can recognize strings in a regular set?
Topic: Core Midterm Concepts
- DFA ✓ Correct answer
- NFA
- PDA
- None of the given
-
In LL(1) parsing algorithm,________ contains a sequence of grammar symbols.
Topic: Core Midterm Concepts
- Stack ✓ Correct answer
- Link List
- Array
- None of the given
-
___________is a regular expression for the set of all strings over the alphabet {a} that has an even number of a' s.
Topic: Core Midterm Concepts
- (aa)* ✓ Correct answer
- (aa)*a
- aa*a
- a*(aa)
-
Consider the grammar A --> B C D B --> h B | epsilon C --> C g | g | C h | i First of B is____________.
Topic: Core Midterm Concepts
- h, i
- h, epsilon ✓ Correct answer
- g
- None of the given
-
__________ Parsers never shifts into an error state.
Topic: Core Midterm Concepts
- LS
- LT
- LR ✓ Correct answer
- LP
-
Reduce ________ action zero or more symbols from the stack
Topic: Core Midterm Concepts
- Pushes
- Pops ✓ Correct answer
- Both push and pops
- None of the given
-
Can a DFA simulate NFA ?
Topic: Core Midterm Concepts
- No
- Yes ✓ Correct answer
- Sometimes
- depends on NFA
-
LR parsing ______________ a string to the start symbol by inverting productions.
Topic: Core Midterm Concepts
- Reduces ✓ Correct answer
- Shifts
- Adds
- None of the given
-
____________avoid hardware stalls and interlocks.
Topic: Core Midterm Concepts
- Register allocation
- Instruction scheduling ✓ Correct answer
- Instruction selection
- None of given
-
IR (Intermediate Representation) stores the value of its operand in _____________.
Topic: Core Midterm Concepts
- Registers ✓ Correct answer
- Memory
- Hard disk
- None Of given
-
Parsers take ___________ as Input from lexical analyzer.
Topic: Core Midterm Concepts
- Linker
- Token ✓ Correct answer
- Instructions
- None of the given
-
Consider the grammar A --> B C D B --> h B | epsilon C --> C g | g | C h | i D --> AB | epsilon First of A is __________.
Topic: Core Midterm Concepts
- h, g, i ✓ Correct answer
- g
- h
- None of the given
-
Consider the grammar A --> B C D B --> h B | epsilon C --> C g | g | C h | i D --> AB | epsilon First of C is ___________.
Topic: Core Midterm Concepts
- g, i ✓ Correct answer
- g
- h, i
- None of the given
-
The shift action _________ a terminal on the stack.
Topic: Core Midterm Concepts
- Pushes ✓ Correct answer
- Pops
- Both push and pops
- None of the given
-
Consider the grammar A --> B C D B --> h B | epsilon C --> C g | g | C h | i D --> A B | epsilon. First of D is ____________.
Topic: Core Midterm Concepts
- h, g
- h
- h, g, i, epsilon ✓ Correct answer
- None of the given
-
___________ read the input character and produce sequence of tokens as output.
Topic: Core Midterm Concepts
- Lexical analyzer ✓ Correct answer
- Parser
- Symbol table
- None of the given
-
The regular expression _________denotes, the set of all strings of a's and b's of length two.
Topic: Core Midterm Concepts
- a*
- (a* | b*)*
- (a*b*)*
- (a|b)(a|b) ✓ Correct answer
-
Compilers are some times classified as.
Topic: Core Midterm Concepts
- Single pass
- Multi pass
- Load and go
- All of the given ✓ Correct answer
-
_____ convert the relocatable machine code into absolute machine code by linking library and relocatable object files.
Topic: Core Midterm Concepts
- Assembler
- Loader/link-editor ✓ Correct answer
- Compiler
- Preprocessor
-
In parser the two LL stand(s) for ____________
Topic: Core Midterm Concepts
- Left-to-right scan of input
- left-most derivation
- All of the given ✓ Correct answer
- None of the given
-
Bottom-up parsing is also called _______________
Topic: Core Midterm Concepts
- LR parsing ✓ Correct answer
- LT parsing
- LS parsing
- SS parsing
-
In a transition table cells of the table contain the ________ state.
Topic: Core Midterm Concepts
- Reject state
- Next state ✓ Correct answer
- Previous state
- None of the given
-
The input specification file to flex consists of-------- section.
Topic: Core Midterm Concepts
- 1
- 2
- 3 ✓ Correct answer
- 4
-
Lexer and scanner are two different phases of compiler
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
Which of the following statements is NOT true?
Topic: Core Midterm Concepts
- The language accepted by finite automate are the languages denoted by regular expression.
- For every DFA there is a regular expression denoting its languages.
- For a regular expression r, there does not exist an NFA that accepts L(r). ✓ Correct answer
- None of the given.
-
A top down parse start with the ----------of the parse tree.
Topic: Core Midterm Concepts
- Root ✓ Correct answer
- Leaf
- Middle
- None of the given
-
The ----------is optimized for hardware it is to run on.
Topic: Core Midterm Concepts
- C++ coding
- C coding
- Assembly code ✓ Correct answer
- None
-
Abstract syntax tree summarizes----------- without the detail of derivation.
Topic: Core Midterm Concepts
- Theory
- Grammatical structure ✓ Correct answer
- Data
- None
-
Alternative to backtrack in top down parser is------------.
Topic: Core Midterm Concepts
- Context free grammar
- Tree
- Look ahead ✓ Correct answer
- None of given
-
The -------------checks the stream of words and their parts of speech for grammatical correctness.
Topic: Core Midterm Concepts
- Parse
- Scanner
- Compiler ✓ Correct answer
- None of the given
-
A grammar must be----------before use for predictive parsing.
Topic: Core Midterm Concepts
- Right factored
- Left factored ✓ Correct answer
- factored
- none of the given
-
Parser does not distinguish between valid and invalid sequences of token.
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
The pair <role,word> is given the name-----
Topic: Core Midterm Concepts
- Word
- Token ✓ Correct answer
- Syntax
- None of the given
-
The ------------ returns a sequence of matching token at output (or an error) and it always return the longest matching token.
Topic: Core Midterm Concepts
- Scanner
- Lexer
- Lexical analyzer ✓ Correct answer
- All of the given
-
LR parsers can handle ________________ grammars.
Topic: Core Midterm Concepts
- Left-recursive ✓ Correct answer
- file-recursive
- End-recursive
- Start-recursive
-
Follow of C is _____________
Topic: Core Midterm Concepts
- g, h, i, $ ✓ Correct answer
- g, h, $
- h, i, $
- h, g, $
-
Consider the grammar A --> B C D B --> h B | epsilon C --> C g | g | C h | i D --> A B | epsilon Follow of B is _____________
Topic: Core Midterm Concepts
- h
- g, h, i, $ ✓ Correct answer
- g, i
- g
-
In PASCAL ___________ represent the inequality test.
Topic: Core Midterm Concepts
- :=
- =
- <> ✓ Correct answer
- None of the given
-
Responsibility of ______________ is to produce fast and compact code.
Topic: Core Midterm Concepts
- Instruction selection ✓ Correct answer
- Register allocation
- Instruction scheduling
- None of given
-
Front end of two pass compiler takes_________________ as input.
Topic: Core Midterm Concepts
- Source code ✓ Correct answer
- Intermediate Representation (IR)
- Machine Code
- None of the Given
-
In Three-pass compiler _____________ is used for code improvement or optimization.
Topic: Core Midterm Concepts
- Front End
- Middle End ✓ Correct answer
- Back End
- Both Front end and Back end
-
We can get an LL(1) grammar by ________________
Topic: Core Midterm Concepts
- Removing left recurrence
- Applying left factoring
- Removing left recurrence and Applying left factoring ✓ Correct answer
- None of the given
-
____________________ phase which supports macro substitution and conditional compilation.
Topic: Core Midterm Concepts
- Semantic
- Syntax
- Preprocessing ✓ Correct answer
- None of given
-
____________tree in which each node represents an operator and children of the node represent the operands.
Topic: Core Midterm Concepts
- Abstract syntax ✓ Correct answer
- Concrete syntax
- Parse
- None of the given
-
In compiler linear analysis is also called.
Topic: Core Midterm Concepts
- Lexical analysis
- Scanning
- Both lexical analysis and scanning ✓ Correct answer
- None of the given
-
Which of the following statement is true about Two pass compiler.
Topic: Core Midterm Concepts
- Front End depends upon Back End
- Back End depends upon Front End ✓ Correct answer
- Both are independent of each other
- None of the given
-
The transition graph for an NFA that recognizes the language ( a | b)*abb will have following set of states.
Topic: Core Midterm Concepts
- {0}
- {0,1}
- {0,1,2}
- {0, 1, 2, 3} ✓ Correct answer
-
Functions of Lexical analyzer are?
Topic: Core Midterm Concepts
- Removing white space
- Removing constants, identifiers and keywords
- Removing comments
- All of the given ✓ Correct answer
-
________ method is known as Subset Construction Method.
Topic: Core Midterm Concepts
- NFA TO DFA ✓ Correct answer
- DFA
- DFA maximization
- None of given
-
Which one is NOT the Role of Run-Time System
Topic: Core Midterm Concepts
- garbage collection
- memory management
- run time error checking
- none of given ✓ Correct answer
-
Compiler_________ information from one representation to another
Topic: Core Midterm Concepts
- modified
- translate ✓ Correct answer
- execute
- extract
-
A non-recursive predictive parser is also called ________________.
Topic: Core Midterm Concepts
- table-driven parser ✓ Correct answer
- Abstract parser
- Conceptual parser
- None of the given
-
Left factoring of a grammar is done to save the parser from _________________.
Topic: Core Midterm Concepts
- Location tracking
- Front tracking
- Back tracking ✓ Correct answer
- Random tracking
-
LL(1) parsing is called ___________________ parsing.
Topic: Core Midterm Concepts
- Predictive ✓ Correct answer
- Non-predictive
- Post-predictive
- Post determine
-
One kind of predictive parser is the ______________________.
Topic: Core Midterm Concepts
- Recursive descent parser ✓ Correct answer
- Bottom-up parser
- Natural parser
- Multilingual parser
-
The algorithm for _____________________ conversion is called Thompson’s Construction.
Topic: Core Midterm Concepts
- DFA to RE
- RE to DFA
- RE to NFA ✓ Correct answer
- CFG to NFA 1
-
The __________________ parser uses a stack to hold the frontier.
Topic: Core Midterm Concepts
- Top-down
- Bottom-up ✓ Correct answer
- Predicative
- LL(1) parsers
-
______________ is the process of discovering a derivation for some sentence of a language.
Topic: Core Midterm Concepts
- Compiling
- Scanning
- Parsing ✓ Correct answer
- Interpretation
-
A ______________ accepts a string if we can follow transitions labeled with characters in the string from start state to some accepting state.
Topic: Core Midterm Concepts
- Finite automata ✓ Correct answer
- Regular expression
- Regular language
- Acceptor
-
The general idea behind NFA-to-DFA construction is that each _______ state corresponds to a set of _______ states.
Topic: Core Midterm Concepts
- DFA, NFA ✓ Correct answer
- NFA, DFA
- NFA, FA
- CFG, NFA
-
Optimal registers allocation is ____________ problem.
Topic: Core Midterm Concepts
- NP-hard
- NP-complete ✓ Correct answer
- Polynomial complete
- Multinomial complete
-
Majority of the algorithms employed in the back-end are ______________________.
Topic: Core Midterm Concepts
- Polynomial time
- NP-Complete ✓ Correct answer
- Np
- None of the given
-
Predictive parser accepts _____________ grammars.
Topic: Core Midterm Concepts
- LL(n+)
- LL(j-)
- LL(k) ✓ Correct answer
- LL(K++)
-
________ and __________ actions are used by bottom-up parsing.
Topic: Core Midterm Concepts
- Break and reduce
- Shift and break
- Shift and reduce ✓ Correct answer
- Shift and expand
-
If the right-hand side of a production has k symbols, it has _________ placeholder positions.
Topic: Core Midterm Concepts
- k
- k+1 ✓ Correct answer
- k+2
- k+3
-
Lexical analyzer function is not ___________________.
Topic: Core Midterm Concepts
- Removing white space
- Removing constants, identifies and keywords
- Removing comments
- Register allocation ✓ Correct answer
-
Parser determines if the input is ___________ well formed.
Topic: Core Midterm Concepts
- Programmatically
- Logically
- Syntactically ✓ Correct answer
- Mechanically
-
Grammar with the _____________ property is called predictive grammar.
Topic: Core Midterm Concepts
- LL(3)
- LL(2)
- LL(1) ✓ Correct answer
- LL(n+)
-
The executable code typically runs as a ____________ in an Operating System Environment.
Topic: Core Midterm Concepts
- Process ✓ Correct answer
- Threads
- Routine
- Function
-
The _______________ builds intermediate Representation (IR) for source program.
Topic: Core Midterm Concepts
- Scanner
- Parser ✓ Correct answer
- Compiler
- Loader
-
Lexer and scanner are _________ phase of compiler.
Topic: Core Midterm Concepts
- Same ✓ Correct answer
- Different
- Backend
- Middle end
-
The ____________ contains a lot of unneeded information.
Topic: Core Midterm Concepts
- Parse tree ✓ Correct answer
- None of the given
- Complete tree
- Abstract syntax tree
-
A ______________ start at the leaves and grows toward root of the parse tree.
Topic: Core Midterm Concepts
- Top-down parser
- Bottom-up parser ✓ Correct answer
- Vertical parser
- Horizontal parser
-
The back end maps intermediate Representation (IR) into target--------------.
Topic: Core Midterm Concepts
- Object code
- Machine code ✓ Correct answer
- Source code
- Linker
-
One of the core tasks of compiler is to generate fast and compact executable code.
Topic: Core Midterm Concepts
- True ✓ Correct answer
- False
-
Left factoring of a grammar is done to save the parser from back tracking.
Topic: Core Midterm Concepts
- True ✓ Correct answer
- False
-
Flex is an automated tool that is used to get the minimized DFA (scanner).
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
For each language to make LL(1) grammar, we take two steps, 1st is removing left recurrence and 2nd is applying left factoring in sequence.
Topic: Core Midterm Concepts
- True ✓ Correct answer
- False
-
NFA is easy to implement as compared to DFA.
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
Parser always gives a tree like structure as output
Topic: Core Midterm Concepts
- True ✓ Correct answer
- False
-
Lexer and scanner are two different phases of compiler
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
Ambiguity can easily be handled by Top-down Parser
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
Backtracking is a costly operation which is caused due to Left Recursion.
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
AST summarizes the grammatical structure with the details of derivations.
Topic: Core Midterm Concepts
- True
- False ✓ Correct answer
-
The DFA uses its state to keep track of ________ the NFA can be in after reading each input symbol.
Topic: Core Midterm Concepts
- Accept state
- Reject state
- Next state
- All possible states ✓ Correct answer
-
Consider the grammar A --> B C D B --> h B | epsilon C --> C g | g | C h | i D --> A B | epsilon. Follow of A is ____________.
Topic: Core Midterm Concepts
- h, $ ✓ Correct answer
- $
- i
- g
-
The handle-finding mechanism is the key to efficient---------------parsing.
Topic: Core Midterm Concepts
- Top-down
- Bottom-up ✓ Correct answer
- Predictive
- None of the given