• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE CS 1996

Question 31

The probability that the top and bottom cards of a randomly shuffled deck are both aces is
  • 4/52 x 4/52
  • 4/52 x 3/52
  • 4/52 x 3/51
  • 4/52 x 4/51

Question 32

If L1 and L2 are context free languages and R a regular set, one of the languages below is not necessarily a context free language, which one?
  • L1 . L2
  • L1 ∩ L2
  • L1 ∩ R
  • L1 ∪ L2

Question 33

Define for a context free language L ⊆ {0, 1}* ,  init(L)={uuv ∈ L for some v in {0,1}∗} ( in other words, init(L) is the set of prefixes of L) Let L = {w ∣ w is nonempty and has an equal number of 0’s and 1’s} Then init(L) is
  • the set of all binary strings with unequal number of 0\'s and 1\'s
  • the set of all binary strings including null string
  • the set of all binary strings with exactly one more 0 than the number of 1’s or one more 1 than the number of 0’s
  • None of the above

Question 34

The grammar whose productions are
 <stmt> → if id then <stmt>
 <stmt> → if id then  <stmt> else <stmt>
 <stmt> → id := id
is ambiguous because a) the sentence  if a then if b then c:= d  has two parse trees b) the left most and right most derivations of the sentence  if a then if b then c:= d  give rise to different parse trees c) the sentence  if a then if b then c:= d else c:= f  has more than two parse trees d) the sentence  if a then if b then c:= d else c:= f  has two parse trees
  • a
  • b
  • c
  • d

Question 35

The minimum number of interchanges needed to convert the array 89, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70 into a heap with the maximum element at the root is

  • 0

  • 1

  • 2

  • 3

Question 36

The recurrence relation

 T(1) = 2
 T(n) = 3T(n/4)+n

has the solution, T(n) equals to

  • O(n)

  • O(log n)

  • O(n^3/4)

  • None of the above

Question 37

The average number of key comparisons done in a successful sequential search in a list of length n is

  • log n

  • (n-1)/2

  • n/2

  • (n+1)/2

Question 38

A binary search tree is generated by inserting in order the following integers:
 50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24 
The number of nodes in the left subtree and right subtree of the root respectively is
  • (4, 7)
  • (7, 4)
  • (8, 3)
  • (3, 8)

Question 39

Quicksort is run on two inputs shown below to sort in ascending order taking the first element as pivot,

(i) 1, 2, 3,......., n
(ii) n, n-1, n-2,......, 2, 1 

Let C1 and C2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,

  • C1 < C2 
     

  • C1 > C2

  • C1 = C2

  • We cannot say anything for arbitrary n

Question 40

The correct matching for the following pairs is
A. Activation record	  1. Linking loader
B. Location counter	    2. Garbage collection
C. Reference counts	    3. Subroutine call
D. Address relocation	  4. Assembler

  • A-3, B-4, C-1, D-2
  • A-4, B-3, C-1, D-2
  • A-4, B-3, C-2, D-1
  • A-3, B-4, C-2, D-1

There are 75 questions to complete.

Last Updated :
Take a part in the ongoing discussion