πŸ“Š Theory of Computation and Compiler Design
Q. Consider the following two problems on undirected graphs:
α: Given G(V,E), does G have an independent set of size |v|—4?
β: Given G(V,E), does G have an independent set of size 5?
Which one of the following is TRUE?
  • (A) α is in P and β is NP-complete
  • (B) α is NP complete and β is in P
  • (C) Both α and β are NP-complete
  • (D) Both α and β are in P
πŸ’¬ Discuss
βœ… Correct Answer: (B) α is NP complete and β is in P
πŸ“Š Theory of Computation and Compiler Design
Q. Let L1 be a recursive language. Let L2 and L3 be languages that are recursively enumerable but not recursive. Which of the following statements is not necessarily true?
  • (A) L2 – L1 is recursively enumerable.
  • (B) L1 – L3 is recursively enumberable
  • (C) L2 intersection L1 is recursively enumberable
  • (D) L2 union L1 is recursively enumberable
πŸ’¬ Discuss
βœ… Correct Answer: (B) L1 – L3 is recursively enumberable
πŸ“Š Theory of Computation and Compiler Design
Q. S –> aSa| bSb| a| b ; The language generated by the above grammar over the alphabet {a,b} is the set of
  • (A) All palindromes.
  • (B) All odd length palindromes.
  • (C) Strings that begin and end with the same symbol
  • (D) All even length palindromes.
πŸ’¬ Discuss
βœ… Correct Answer: (B) All odd length palindromes.
πŸ“Š Theory of Computation and Compiler Design
Q. In a compiler, keywords of a language are recognized during
  • (A) parsing of the program
  • (B) the code generation
  • (C) the lexical analysis of the program
  • (D) dataflow analysis
πŸ’¬ Discuss
βœ… Correct Answer: (C) the lexical analysis of the program
πŸ“Š Theory of Computation and Compiler Design
Q. The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
  • (A) Finite state automata
  • (B) Deterministic pushdown automata
  • (C) Non-Deterministic pushdown automata
  • (D) Turing Machine
πŸ’¬ Discuss
βœ… Correct Answer: (A) Finite state automata
πŸ“Š Theory of Computation and Compiler Design
Q. Consider the following statements:
(I) The output of a lexical analyzer is groups of characters.
(II) Total number of tokens in printf("i=%d, &i=%x", i, &i); are 11.
(III) Symbol table can be implementation by using array and hash table but not tree.
Which of the following statement(s) is/are correct?
  • (A) Only (I)
  • (B) Only (II) and (III)
  • (C) All (I), (II), and (III)
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (D) None of these
πŸ“Š Theory of Computation and Compiler Design
Q. Which one of the following statements is FALSE?
  • (A) Context-free grammar can be used to specify both lexical and syntax rules.
  • (B) Type checking is done before parsing.
  • (C) High-level language programs can be translated to different Intermediate Representations.
  • (D) Arguments to a function can be passed using the program stack.
πŸ’¬ Discuss
βœ… Correct Answer: (B) Type checking is done before parsing.
πŸ“Š Theory of Computation and Compiler Design
Q. A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}. T1: a?(b∣c)*a T2: b?(a∣c)*b T3: c?(b∣a)*c Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. If the string bbaacabc is processes by the analyzer, which one of the following is the sequence of tokens it outputs?
  • (A) T1T2T3
  • (B) T1T1T3
  • (C) T2T1T3
  • (D) T3T3
πŸ’¬ Discuss
βœ… Correct Answer: (D) T3T3
πŸ“Š Theory of Computation and Compiler Design
Q. Consider the following statements related to compiler construction :
I. Lexical Analysis is specified by context-free grammars and implemented by pushdown automata.
II. Syntax Analysis is specified by regular expressions and implemented by finite-state machine. Which of the above statement(s) is/are correct?
  • (A) Only I
  • (B) Only II
  • (C) Both I and II
  • (D) Neither I nor II
πŸ’¬ Discuss
βœ… Correct Answer: (D) Neither I nor II
πŸ“Š Theory of Computation and Compiler Design
Q. Which of the following statement(s) regarding a linker software is/are true?
I. A function of a linker is to combine several object modules into a single load module.
II. A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules.
  • (A) Only I
  • (B) Only II
  • (C) Both I and II
  • (D) Neither I nor II
πŸ’¬ Discuss
βœ… Correct Answer: (A) Only I

Jump to