• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE-CS-2006

Question 11

Consider a weighted complete graph G on the vertex set {v1, v2, ..vn} such that the weight of the edge (vi, vj) is 2|i-j|. The weight of a minimum spanning tree of G is: (GATE CS 2006)
  • n — 1
  • 2n — 2
  • nC2
  • 2

Question 12

To implement Dijkstra’s shortest path algorithm on unweighted graphs so that it runs in linear time, the data structure to be used is:
  • Queue
  • Stack
  • Heap
  • B-Tree

Question 13

A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. the root is stored at X[1]. For a node stored at X[i], the left child, if any, is stored in X[2i] and the right child, if any, in X[2i+1]. To be able to store any binary tree on n vertices the minimum size of X should be.
  • log2n
  • n
  • 2n + 1
  • 2^n — 1

Question 14

Which one of the following in place sorting algorithms needs the minimum number of swaps?

  • Quick sort

  • Insertion sort

  • Selection sort

  • Heap sort

Question 15

Consider the following C-program fragment in which i, j and n are integer variables. C
for (i = n, j = 0; i >0; i /= 2, j += i);
Let val(j) denote the value stored in the variable j after termination of the for loop. Which one of the following is true? (A) val(j) = [Tex]\\theta[/Tex](logn) (B) vaI(j) = [Tex]\\theta[/Tex](sqrt(n)) (C) val(j) = [Tex]\\theta[/Tex](n) (D) val(j) = [Tex]\\theta[/Tex](nlogn)
  • A
  • B
  • C
  • D

Question 16

Let S be an NP-complete problem and Q and R be two other problems not known to be in NP. Q is polynomial time reducible to S and S is polynomial-time reducible to R. Which one of the following statements is true?
  • R is NP-complete
  • R is NP-hard
  • Q is NP-complete
  • Q is NP-hard

Question 17

An element in an array X is called a leader if it is greater than all elements to the right of it in X. The best algorithm to find all leaders in an array.
  • Solves it in linear time using a left to right pass of the array
  • Solves it in linear time using a right to left pass of the array
  • Solves it using divide and conquer in time Theta(nlogn)
  • Solves it in time Theta(n^2)

Question 18

We are given a set X = {x1, .... xn} where xi = 2i. A sample S ⊆ X is drawn by selecting each xi independently with probability pi = 1/2. The expected value of the smallest number in sample S is:
  • 1/n
  • 2
  • sqrt(n)
  • n

Question 19

GATECS2006Q18
  • L1 only
  • L3 Only
  • L1 and L2
  • L2 and L3

Question 20

Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.
  1. T1 start
  2. T1 B old=12000 new=10000
  3. T1 M old=0 new=2000
  4. T1 commit
  5. T2 start
  6. T2 B old=10000 new=10500
  7. T2 commit 
Suppose the database system crashes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?
  • We must redo log record 6 to set B to 10500
  • We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.
  • We need not redo log records 2 and 3 because transaction T1 has committed.
  • We can apply redo and undo operations in arbitrary order because they are idempotent

There are 84 questions to complete.

Last Updated :
Take a part in the ongoing discussion