SUPERSTARWEBTECH

There is no elevator to success. You have to take the stairs. Take your first steps with SSWT!

CS606 Compiler Construction Quiz MCQs Lecture 1-22 MidTerm Objective Questions

CS606-Compiler Construction Quiz #Objective #Questions

1. Which of the following statement is true about Two-pass compiler.

  • Front End depends upon Back End
  • Back End depends upon Front End ✔
  • Both are independent of each other
  • None

2. In a three-pass compiler, ___ is used for code improvement or optimization.

  • Front End
  • Middle End ✔
  • Back End
  • Both Front End and Back End

3. In multi-pass compiler during the first pass, it gathers information about ___

  • Declaration ✔
  • Bindings
  • Static information
  • None

4. Which of the statement is true about Regular Languages?

  • Regular Languages are the most popular for specifying tokens.
  • Regular Languages are based on simple and useful theory.
  • Regular Languages are easy to understand
  • All of the given ✔

5. The DFA uses its state to keep track of ___ the NFA can be in after reading each input symbol.

  • Accept state
  • Reject state
  • Next state
  • All possible states ✔

6. In ___ certain check are performed to ensure that components of a program fit together meaningfully.

  • Linear analysis
  • Hierarchical analysis
  • Semantic analysis ✔
  • None

7. Compilers are some times classifies as:

  • Single-pass
  • Multipass
  • Load and go
  • All of the given ✔

8. In compiler, linear analysis is also called

  • Lexical analysis
  • Scanning
  • Both lexical analysis and scanning ✔
  • None

9. In a transition table cells of the table contain the ___ state.

  • Reject state
  • Next state ✔
  • Previous state
  • None

10. In Back End module of the compiler, optimal register allocation uses ___.

  • O(log n)
  • O(n log n)
  • NP-Complete ✔
  • None

11. A non-recursive predictive parser is also called ___

  • table-driven parser ✔
  • Abstract parser
  • Conceptual parser
  • None

12. The shift action ___ a terminal on the stack

  • Pushes ✔
  • Pops
  • Both pushes and pops
  • None

13. Bottom-up parsing is also called ___

  • LR parsing ✔
  • LT parsing
  • LS parsing
  • SS parsing

14. ___ of a two-pass compiler is consists of instruction selection, Register allocation and instrcution scheduling

  • Backend ✔
  • Frontend
  • Start
  • None

15. Consider the grammar
A -> B C C
B -> h B | epsilon
C -> C g | g | C h | i
D -> A B | epsilon
First of A is ___

  • h, g, i
  • g
  • h ✔
  • None

16. A -> B C C
B -> h B | epsilon
C -> C g | g | C h | i

D -> A B | epsilon
Follow of A ___
  • h, $
  • $
  • i
  • g
17. A -> B C C
B -> h B | epsilon
C -> C g | g | C h | i
D -> A B | epsilon

Follow of C is ___

  • g, h, i, $ ✔
  • g, h, $
  • h, i, $
  • h, g, $

18. Left factoring of grammar is done to save the parser from backtracking.

  • True ✔
  • False

19. Typical compilation means programs written in high-level languages to low-level ___

  • Object code
  • Byte code
  • Unicode
  • Object code and byte code ✔
20. In compilation process, Hierarchical analysis is also called ___
  • Parsing
  • Syntax
  • Parsing and Syntax analysis ✔
  • None
21. IR (Intermediate Representation) stores the value of its operand in ___
  • Registers ✔
  • Memory
  • Hard disk
  • None
22. A lexeme is a sequence of characters in the source program that is matched by the pattern for a ___
  • Linker
  • Token ✔
  • Control flow
  • None
23. Parsers take ___ as Input from lexical analyzer.
  • Linker
  • Token ✔
  • Instructions
  • None
24. What kind of abstract machine can recognize strings in a regular set?
  • DFA ✔
  • NFA
  • PDA
  • None
25. In DFA minimization, we construct one ___ for each group of states from the initial DFA.
  • State ✔
  • NFA
  • PDA
  • None

26. ___ (lexical Analyzer generator), is written in Java

  • Flex
  • Jlex ✔
  • Complex
  • None
27. In flex specification file, different sections are separated by ___
  • %% ✔
  • &&
  • ##
  • None
28. Recursive ___ parsing is done for LL(I) grammar.
  • Descent y✔
  • Ascent
  • Forward
  • None
29. Alternative of the backtrack in parser is Look ahead symbol in ___
  • Input ✔
  • Output
  • Input and Output
  • None
30. Parser takes tokens from scanner and tries to generate ___
  • Binary Search Tree
  • Parse tree ✔
  • Binary Search and Parse tree
  • None
31. In predictive parsing table, the rows represents ___
  • Terminals
  • Both non-terminals and terminals
  • Non-terminals ✔
  • None
32. In LL(I) parsing algorithm, ___ contains a sequence of grammar symbols.
  • Stack ✔
  • Link list
  • Array
  • None
33. Consider the grammar
A -> B C D
B -> h B | epsilon
C -> C g | g | C h | i
D -> A B | epsilon
First of C is ___
  • g, i ✔
  • g
  • h, i
  • None
34. Bottom-up parsing uses only ___ kinds of actions.
  • Two ✔
  • Three
  • Four
  • Five
35. Reduce ___ action zero or more symbols from the stack.
  • Pushes
  • Pops ✔
  • Both push and pops
  • None
36. Back End of two-pass compiler uses ___ algorithm
  • O(n)
  • O(n log n)
  • NP complete ✔
  • None
37. The Back End of a compiler consists of ___
  • Instruction selection ✔
  • Register allocation
  • Instruction scheduling
  • All of given
38. ___ is a regular expression for the set of all strings over the alphabet {a} that has an even number of a’s
  • aa*
  • (aa)* ✔
  • aa*a
  • a(aa)*
39. ___ algorithm is used in DFA minimization.
  • Jame’s
  • Robert’s
  • Hopcroft’s y✔
  • None
40. ___ is an important component of semantic analysis.
  • Code checking
  • Type checking ✔
  • Flush checking
  • None
41. Consider the grammar
A – > B C D
B -> h B | epsilon
C -> C g | g | C h | i
First of B is ___
  • h, i
  • h, epsilon ✔
  • g
  • None
42. 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 ___
  • h, g
  • h
  • h, g, i, epsilon ✔
  • None
43. ___ parsers never shifts into an error state.
  • LS
  • LT
  • LR ✔
  • LP
44. ___ read the input character and produce sequence of tokens as output.
  • Lexical analyzer ✔
  • Parser
  • Symbol table
  • None
45. The regular expression ___ denotes, the set of all strings of a’s and b’s of length two.
  • a*
  • (a*| b*)*
  • (a*b*)*
  • (a|b)(a|b) ✔
46. ___ is evaluated to yield a value.
  • Command
  • Expression ✔
  • Declaration
  • None
47. Bottom-up parsers handle a ___ class of grammar
  • Large ✔
  • Small
  • Medium
  • None
48. LR parsers can handle ___ grammars.
  • Left-recursive ✔
  • File-recursive
  • End-recursive
  • Start-recursive
49. ___ convert the relocatable machine code into absolute machine code by linking library and relocatable object files.
  • Assembler
  • Loader/link-editor ✔
  • Compiler
  • Preprocessor
50. 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 ___
  • h ✔
  • g, h, i, $
  • g, i
  • g
51. In PASCAL ___represent the inequality test.
  • :=
  • =
  • <> ✔
  • None
52. ___ avoid hardware stalls and interlocks.
  • Register allocation
  • Instruction scheduling ✔
  • Instruction selection
  • None
53. One of the core tasks of compiler is to generate fast and compact executable code.
  • True ✔
  • False
54. Responsibility of ___ is to produce fast and compact code.
  • Instruction selection ✔
  • Register allocation
  • Instruction scheduling
  • None
55. Compilers are sometimes classified as
  • Single pass
  • Multi pass
  • Load and go
  • All of given ✔
56. Flex is an automated tool that is used to get the minimized DFA (scanner).
  • True
  • False ✔
57. 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.
  • True ✔
  • False
58. Optimal registers allocation is an NP-hard problem.
  • True
  • False ✔
59. Front end of two pass compiler takes ___ as input.
  • Source code ✔
  • Intermediate Representation (IR)
  • Machine code
  • None
60. NFA is easy to implement as compared to DFA
  • True
  • False ✔
61. We can get an LL(1) grammar by ___
  • Removing left recurrence
  • Applying left factoring
  • Removing left recurrence and Applying left factoring ✔
  • None
62. Parser always gives a tree like structure as output
  • True
  • False
63. Lexer and scanner are two different phases of compiler.
  • True
  • False ✔
64. ___ phase which supports macro substitution and conditional compilation.
  • Semantic
  • Syntax
  • Preprocessing ✔
  • None
65. ___ tree in which each node represents an operator and children of the node represent the operands
  • Abstract syntax ✔
  • Concrete syntax
  • Parse
  • None

66. Ambiguity can easily be handled by top-down parser

  • True ✔
  • False
67. LR parsing ___ a string to the start symbol by inverting productions.
  • Reduces ✔
  • Shifts
  • Adds
  • None
68. In parser the two LL stand(s) for ___
  • Left-to-right scan of input
  • left-most derivation
  • All of the given ✔
  • None
69. Can a DFA simulate NFA?
  • Yes ✔
  • No
  • Sometimes
  • Depend upon NFA
70. The transition graph for an NFA that recognized the language (a|b)*abb will have following set of states.
  • {0}
  • {0, 1}
  • {0, 1, 2}
  • {0, 1, 2, 3} ✔
71. Functions of Lexical analyzer are?
  • Removing white space
  • Removing constants, identifiers and keywords
  • Removing comments
  • All of given ✔
72. ___ method is known as subset construction method.
  • NFA to DFA ✔
  • DFA
  • DFA maximization
  • None
73. Which one is NOT the Role of Run-Time System?
  • garbage collection
  • memory management
  • run time error checking
  • None ✔
74. Compiler ___ information from one representation to another.
  • modified
  • translate ✔
  • execute
  • extract
75. Front-end of a two pass compiler is consists of scanner.
  • True
  • False ✔
76. Backtracking is a costly operation which is caused due to Left Recursion.
  • True
  • False ✔
77. AST summarizes the grammatical structure with the details of derivations.
  • True
  • False ✔
78. Backtrack is term associated with Top-down parsing.
  • True ✔
  • False
79. Which of the following statement/s is/are true about Deterministic Finite Automata?
80. The lexical analyzer partition input string into substrings called ___

Author

Anam Afzal

Anam Afzal

Hi, I'm a Pakistani freelancer with a passion for helping businesses achieve their online goals through no-code solutions. I specialize in WordPress customization and ManyChat automation, and I'm always on the lookout for new ways to use technology to make businesses more efficient and successful. I'm also a big believer in the power of no-code tools to democratize technology and make it accessible to everyone. I'm passionate about sharing my knowledge and helping others learn how to use no-code tools to create their own websites, automate their workflows, and grow their businesses. If you're looking for a reliable and experienced no-code developer, I'm here to help. Please feel free to contact me to discuss your project requirements.
SHARE THIS POST