UGC NET · PAPER 2
UGC NET Paper 2 Computer Science – Unit 8: Theory of Computation and Compilers PYQ (December 2023)
Q21. Let L = {ab, aa, baa}. Which of the following strings is NOT in L*?
- abaabaaabaa
- aaaabaaaa
- baaaaabaaaab
- baaaaabaa
Q22. Let A = {a, b} and L = A*. Let X = {aⁿbⁿ | n > 0}. The languages L ∪ X and X are respectively:
- Not regular, Regular
- Regular, Regular
- Regular, Not regular
- Not regular, Not regular
Q23. Which of the following symbol-table implementations is best suited if access time is to be minimum?
- Linear list
- Search tree
- Hash table
- Self-organising list
Q24. Consider the grammar E → E + n | E × n | n. For the sentence n + n × n, the handles in the right-sentential forms of the reduction are:
- n, E + n and E + n × n
- n, E + n and E + E × n
- n, n + n and n + n × n
- n, E + n and E × n
Q30. One of the purposes of using intermediate code in compilers is to:
- make parsing and semantic analysis simpler
- improve error recovery and error reporting
- increase the chances of reusing the machine-independent code optimizer in other compilers
- improve the register allocation
Q31. The sum of the minimum and maximum number of final states for a DFA having P states is equal to:
- P
- P − 1
- P + 1
- P + 2
Q54. Three-address code can be represented in special structures known as:
(A) Quadruples
(B) Triples
(C) Patterns
(D) Indirect Triples
Choose the correct answer from the options given below:
(A) Quadruples
(B) Triples
(C) Patterns
(D) Indirect Triples
Choose the correct answer from the options given below:
- (A) and (B) Only
- (A), (B) and (D) Only
- (B) and (C) Only
- (B), (C) and (D) Only
Q55. Which of the statements is/are CORRECT?
(A) Moore and Mealy machines are finite state machines with output capabilities.
(B) Any given Moore machine has an equivalent Mealy machine.
(C) Any given Mealy machine has an equivalent Moore machine.
(D) A Moore machine is not a finite state machine.
Choose the correct answer from the options given below:
(A) Moore and Mealy machines are finite state machines with output capabilities.
(B) Any given Moore machine has an equivalent Mealy machine.
(C) Any given Mealy machine has an equivalent Moore machine.
(D) A Moore machine is not a finite state machine.
Choose the correct answer from the options given below:
- (A) and (B) Only
- (A), (B) and (C) Only
- (B) and (D) Only
- (A), (B) and (D) Only
Q71. Match List I with List II according to the input to the compiler phase that processes it:
| List I | List II |
|---|---|
| (a) Syntax tree | (I) Code generator |
| (b) Intermediate representation | (II) Semantic analyzer |
| (c) Token stream | (III) Lexical analyzer |
| (d) Character stream | (IV) Syntax analyzer |
- (a)-(IV), (b)-(III), (c)-(I), (d)-(II)
- (a)-(II), (b)-(I), (c)-(IV), (d)-(III)
- (a)-(II), (b)-(IV), (c)-(I), (d)-(III)
- (a)-(IV), (b)-(I), (c)-(II), (d)-(III)
Q81. Arrange the following phases of a compiler in their order of execution (start to end):
(a) Target code generation
(b) Syntax analysis
(c) Code optimization
(d) Semantic analysis
(e) Lexical analysis
Choose the correct answer from the options given below:
(a) Target code generation
(b) Syntax analysis
(c) Code optimization
(d) Semantic analysis
(e) Lexical analysis
Choose the correct answer from the options given below:
- (b), (e), (d), (a), (c)
- (e), (d), (b), (a), (c)
- (e), (b), (d), (c), (a)
- (b), (d), (e), (a), (c)