• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE-CS-2003

Question 51

Consider two languages L1 and L2 each on the alphabet ∑. Let f : ∑ → ∑ be a polynomial time computable bijection such that (∀ x) [x ∈ L1 if f(x) ∈ L2]. Further, let f-1 be also polynomial time computable. Which of the following CANNOT be true?

  • L1 ∈ P and L2 is finite

  • L1 ∈ NP and L2 ∈ P

  • L1 is undecidable and L2 is decidable

  • L1 is recursively enumerable and L2 is recursive

Question 52

A single tape Turing Machine M has two states q0 and q1, of which q0 is the starting state. The tape alphabet of M is {0, 1, B} and its input alphabet is {0, 1}. The symbol B is the blank symbol used to indicate end of an input string. The transition function of M is described in the following table
 0  1  B
 q0  q1, 1, R  q1, 1, R  Halt
 q1  q1, 1, R  q0, 1, L  q0, B, L
  The table is interpreted as illustrated below. The entry (q1, 1, R) in row q0 and column 1 signifies that if M is in state q0 and reads 1 on the current tape square, then it writes 1 on the same tape square, moves its tape head one position to the right and transitions to state q1. Which of the following statements is true about M ?
  • M does not halt on any string in (0 + 1)+
  • M does not halt on any string in (00 + 1)*
  • M halts on all string ending in a 0
  • M halts on all string ending in a 1

Question 53

Define languages L0 and L1 as follows :
L0 = {< M, w, 0 > | M halts on w}
L1 = {< M, w, 1 > | M does not halts on w} 
Here < M, w, i > is a triplet, whose first component. M is an encoding of a Turing Machine, second component, w, is a string, and third component, i, is a bit. Let L = L0 ∪ L1. Which of the following is true ?
  • L is recursively enumerable, but L\' is not
  • L\' is recursively enumerable, but L is not
  • Both L and L\' are recursive
  • Neither L nor L\' is recursively enumerable

Question 54

Consider the NFA M shown below.                           

[caption width="800"] [/caption]

 Let the language accepted by M be L. Let L1 be the language accepted by the NFA M1, obtained by changing the accepting state of M to a non-accepting state and by changing the non-accepting state of M to accepting states. Which of the following statements is true ?

  • L1 = {0, 1}* - L

  • L1 = {0, 1}*

  • L1 ⊆ L

  • L1 = L

Question 55

Consider the grammar shown below
S → i E t S S\' | a
S\' → e S | ε
E → b 
In the predictive parse table. M, of this grammar, the entries M[S\', e] and M[S\', $] respectively are
  • {S\' → e S} and {S\' → e}
  • {S\' → e S} and {}
  • {S\' → ε} and {S\' → ε}
  • {S\' → e S, S\'→ ε} and {S\' → ε}

Question 56

Consider the grammar shown below.
S → C C
C → c C | d
The grammar is
  • LL(1)
  • SLR(1) but not LL(1)
  • LALR(1) but not SLR(1)
  • LR(1) but not LALR(1)

Question 57

Consider the translation scheme shown below
S → T R
R → + T {print (\'+\');} R | ε
T → num {print (num.val);} 
Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string \'9 + 5 + 2\', this translation scheme will print
  • 9 + 5 + 2
  • 9 5 + 2 +
  • 9 5 2 + +
  • + + 9 5 2

Question 58

Consider the syntax directed definition shown below.
S → id : = E  {gen (id.place = E.place;);}
E → E1 + E2   {t = newtemp ( ); gen (t = El.place + E2.place;); E.place = t}
E → id     {E.place = id.place;} 
Here, gen is a function that generates the output code, and newtemp is a function that returns the name of a new temporary variable on every call. Assume that ti\'s are the temporary variable names generated by newtemp. For the statement \'X: = Y + Z\', the 3-address code sequence generated by this definition is
  • X = Y + Z
  • t1 = Y + Z; X = t1
  • t1 =Y; t2 = t1 + Z; X = t2
  • t1 = Y; t2 = Z; t3 = t1 + t2; X = t3

Question 59

A program consists of two modules executed sequentially. Let f1(t) and f2(t) respectively denote the probability density functions of time taken to execute the two modules. The probability density function of the overall time taken to execute the program is given by :
		 
A) [Tex]f_{1}(t)+f_{2}(t)[/Tex]
B) [Tex]\\int_{0}^{t}f_{1}(x)f_{2}(x)dx[/Tex]
C) [Tex]\\int_{0}^{t}f_{1}(x)f_{2}(t-x)dx[/Tex]
D) [Tex]max\\left \\{ f_{1}(t),f_{2}(t) \\right \\}[/Tex]
  • A
  • B
  • C
  • D

Question 60

In a permutation a1.....an of n distinct integers, an inversion is a pair (ai, aj) such that i < j and ai > aj. If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of 1.....n ?
  • n(n - 1)/2
  • n(n - 1)/4
  • n(n + 1)/4
  • 2n[log2 n]

There are 89 questions to complete.

Last Updated :
Take a part in the ongoing discussion