0% found this document useful (0 votes)
3 views4 pages

Mid2 Objective Questions

The document contains a series of questions and answers related to concepts in computer science, specifically focusing on Turing machines, parsing techniques, and compiler components. It includes multiple-choice questions about languages accepted by different machines, types of parsers, and phases of compilation, as well as fill-in-the-blank questions regarding lexical analysis and intermediate code representation. The answers provided indicate the correct options for each question.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Mid2 Objective Questions

The document contains a series of questions and answers related to concepts in computer science, specifically focusing on Turing machines, parsing techniques, and compiler components. It includes multiple-choice questions about languages accepted by different machines, types of parsers, and phases of compilation, as well as fill-in-the-blank questions regarding lexical analysis and intermediate code representation. The answers provided indicate the correct options for each question.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

P age |1

1 A Turing machine has a special tape symbol which is called as


a. epsilon b. Blank
c. gamma d. None of the above
2 The Language accepted by a PDA is
a. Regular b. Context-free
c. Recursively enumerable d. None of the above
3 Which component of a compiler takes input as tokens and constructs a parse tree

a. Parser b. Lexical analyzer


c. Optimizer d. semantic analyzer
4 The PDA has memory element which is represented as
a. Stack b. Queue
c. Heap d. None of the above
5 Which of the following is Top down parser
a. LL(1) b. SLR
c. CLR d. None of the above
6 Which of the following is Bottom up parser
a. LL(1) b. SLR

c. predictive d. None of the above


7 Code optimization is a phase which is responsible for
a. Code generation b. Lexical analysis
c. Reduction in the length of code d. semantic analysis
8 To construct Top Down parsing table the grammar should be
a. Left Recursive b. Not Left Recursive
c. Ambiguous d. None of the above
9 A CFG is ambiguous if it has
a. more than one LMD for a given string b. more than one RMD for a given
string
c. Either a or b d. Both a and b
10 In a three address code scheme an instruction can have at most
a. 3 operands b. 4 operands
c. 5 operands d. None of the above
P age |2

11 The formal definitions of a Turing machine has


a. 5 tuples b. 6 tuples [ ]

c. 7 tuples d. None of the above


12 The Language accepted by a Turing machine is
a. Regular b. Context-free [ ]
c. Recursively enumerable d. None of the above
13 Which component of a compiler takes input and constructs a stream of tokens
[ ]
a. Parser b. Lexical analyzer
c. Code generation d. Code optimization
14 The PDA is equivalent to
[ ]
a. DFA b. DFA + stack
c. DFA + Queue d. None of the above
15 Which of the following is Top down parser
a. LL(1) b. SLR [ ]
c. CLR d. None of the above
16 Which of the following is Bottom up parser
a. LL(1) b. SLR [ ]

c. predictive d. None of the above


17 DAG stands for
a. Directed acyclic graph b. Directed ambiguous graph [ ]

c. Directed autonomous graph d. None of the above


18 To construct LL(1) parsing table the grammar should be
a. Left Recursive b. Not Left Recursive [ ]

c. Ambiguous d. None of the above


19 A CFG is ambiguous if it has
a. more than one LMD for a given string b. more than one RMD for a given [ ]
string
c. Either a or b d. Both a and b
20 In order to construct SLR(1) parsing table we should construct
a. FIRST set of Non Terminals b. FOLLOW set of Non Terminals [ ]
c. Both (a) and (b) d. None of the above

Answers: 1. b , 2. B , 3. A , 4. A, 5. A, 6. B, 7. C, 8. B, 9. C, 10. A, 11. C, 12. C, 13. B, 14. b, 15. A, 16.


B, 17. A, 18. B, 19. C, 20. c
P age |3

Fill in the Blanks


1 _____________ analyzer reads the source code and breaks it into tokens

Ans: Lexical

2 A Turing machine has a read / write head and can move its head in ______________ direction.

Ans: left and right

3 The set of languages accepted by turing machine are ______________ languages

Ans: Recursive enuberable


4 _______________ buffering is used to speed up lexical analysis

Ans: Input buffering


5 Three address code is a form of ___________ code used in compilers.

Ans: Intermediate
6 ____________ phase constructs an object code.

Ans: Code generation

7 The ___________ tool is used to automatically generate lexical analyzers

Ans: LEX tool

8 Consider the production S  aBC, Follow(B) is ____________

Ans: FIRST(C)
9 Assume X as a terminal. FIRST( X) is _________

Ans: X
10 FOLLOW SET of the starting symbol in a grammar always contains a _______ symbol.

Ans: $

11 _____________ analyzer reads the source code and breaks it into tokens.

Ans: Lexical
12 A Turing machine simulates memory element through its ______________

Ans: Tape
13 The set of languages accepted by PDA machine are ______________ languages

Ans: Context free


14 _______________ buffering is used to speed up lexical analysis

Ans: Input buffering


P age |4

15 Give on example of Intermediate code representation: __________________

Ans: Three address code


16 ____________ phase in a compiler constructs an Parse tree.

Ans: Syntax Analysis


17 The output of Lexical analyzer is ____________________

Ans: Stream of tokens


18 Consider the production S  aBC, Follow(B) is ____________

Ans: FIRST(C)
19 Assume X as a terminal. FIRST( X) is _________

Ans: X
20 FOLLOW SET of the starting symbol in a grammar always contains a _______ symbol

Ans: $

You might also like