GATE 2013 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2013

80 questions

MCQ 801-mark 38 · 2-mark 42

Questions 36–40 of 80

Q36Turing Machine1 markMCQ−0.33 if wrong
Which of the following statements is/are FALSE?
1. For every non-deterministic Turing machine, there exists an equivalent deterministic Turing machine.
2. Turing recognizable languages are closed under union and complementation.
3. Turing decidable languages are closed under intersection and complementation.
4. Turing recognizable languages are closed under union and intersection.

Q37Undecidability2 marksMCQ−0.67 if wrong
Which of the following is/are undecidable?
1. G is a CFG. Is L(G) = Φ\Phi?
2. G is a CFG. Is L(G) = Σ∗\Sigma ^{*} ?
3. M is a Turing machine. Is L(M) regular?
4. A is a DFA and N is an NFA. Is L(A) = L(N)?

Q38Parsing2 marksMCQ−0.67 if wrong
Consider the following two sets of LR(1) items of an LR(1) grammar.

X→c.X,c∕dX→c.X,$X→.cX,c∕  d X→.cX,$X→.d,c∕ d X→.d,$\begin{array}{l|l} X \rightarrow c.X, c∕d &X → c.X, \$\\ X \rightarrow .cX, c∕  d& X → .cX, \$\\ X \rightarrow .d, c∕ d & X → .d, \$ \end{array}

Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE?
1. Cannot be merged since look aheads are different.
2. Can be merged but will result in S-R conflict.
3. Can be merged but will result in R-R conflict.
4. Cannot be merged since goto on c will lead to two different sets.

Q39Parsing1 markMCQ−0.33 if wrong
What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A→ϵA\rightarrow \epsilon and A→aA \rightarrow a) to parse a string with n tokens?

Q40Intermediate Code Generation2 marksMCQ−0.67 if wrong
The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment.
c = a + b;
d = c * a;
e = c + a;
x = c * c;
if (x > a) {
   y = a * a;
}
else {
   d = d * d;
   e = e * e;
} 
What is the minimum number of registers needed in the instruction set architecture of the processor to compile this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation