Top 80+ Solved Theory of Computation and Compiler Design MCQ Questions Answer

From 46 to 60 of 74

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

  • a. Finite state automata

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.

  • b. Type checking is done before parsing.

Q. In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction?

a. Replace P + P by 2 * P or Replace 3 + 4 by 7.

b. Replace P * 32 by P < < 5

c. Replace P * 0 by 0

d. Replace (P < <4) – P by P * 15

  • b. Replace P * 32 by P < < 5

Q. Debugger is a program that

a. allows to examine and modify the contents of registers

b. does not allow execution of a segment of program

c. allows to set breakpoints, execute a segment of program and display contents of register

d. All of the above

  • c. allows to set breakpoints, execute a segment of program and display contents of register

Q. Which of the following describes a handle (as applicable to LR-parsing) appropriately?

a. It is the position in a sentential form where the next shift or reduce operation will occur

b. It is non-terminal whose production will be used for reduction in the next step

c. It is a production that may be used for reduction in a future step along with a position in the sentential form where the next shift or reduce operation will occur

d. It is the production p that will be used for reduction in the next step along with a position in the sentential form where the right hand side of the production may be found

  • d. It is the production p that will be used for reduction in the next step along with a position in the sentential form where the right hand side of the production may be found

Q. An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if andonly if

a. the SLR(1) parser for G has S-R conflicts

b. the LR(1) parser for G has S-R conflicts

c. the LR(0) parser for G has S-R conflicts

d. the LALR(1) parser for G has reduce-reduce conflicts

  • b. the LR(1) parser for G has S-R conflicts

Q. Consider the following two statements:P: Every regular grammar is LL(1)Q: Every regular set has a LR(1) grammarWhich of the following is TRUE?

a. Both P and Q are true

b. P is true and Q is false

c. P is false and Q is true

d. Both P and Q are false

  • c. P is false and Q is true
Subscribe Now

Get All Updates & News