GATE CS Applied Course

GATE Previous Year Wise Questions

GATE Previous Subject Wise Questions

Question 261
What is the time complexity of the following recursive function:
int DoSomething (int n)
{
  if (n <= 2)
    return 1;
  else
    return (DoSomething (floor(sqrt(n))) + n);
}
 
A
Ω (n2)
B
θ (nlog2 n)
C
θ (log2 n)
D
θ (log2log2 n)
Algorithms Time-Complexity GATE 2007 CS
Question 262
Consider the following C program segment where CellNode represents a node in a binary tree:

struct CellNode
{
  struct CellNOde *leftChild;
  int element;
  struct CellNode *rightChild;
};
int GetValue(struct CellNode *ptr)
{
  int value = 0;
  if (ptr != NULL)
  {
   if ((ptr->leftChild == NULL) &&
        (ptr->rightChild == NULL))
      value = 1;
   else
      value = value + GetValue(ptr->leftChild)
                   + GetValue(ptr->rightChild);
  }
  return(value);
}

The value returned by GetValue() when a pointer to the root of a binary tree is passed as its argument is:
A
the number of nodes in the tree
B
the number of internal nodes in the tree
C
the number of leaf nodes in the tree
D
the height of the tree
Data Structures Binary-Trees GATE 2007 CS
Question 263
Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:  
A
θ(log2n)
B
θ(log2log2n)
C
θ(n)
D
θ(nlog2n)
Data Structures Heap-Tree GATE 2007 CS
Question 264
Let w be the minimum weight among all edge weights in an undirected connected graph. Let e be a specific edge of weight w. Which of the following is FALSE?
A
There is a minimum spanning tree containing e.
B
If e is not in a minimum spanning tree T, then in the cycle formed by adding e to T, all edges have the same weight
C
Every minimum spanning tree has an edge of weight w
D
e is present in every minimum spanning tree
Algorithms Minimum-Spanning-Tree GATE 2007 CS
Question 265
An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the number of comparisons needed?
A
At least 2n - c comparisons, for some constant c, are needed.
B
At most 1.5n - 2 comparisons are needed.
C
At least nlog2n comparisons are needed
D
None of the above
Algorithms Time-Complexity GATE 2007 CS
Question 266
Consider the following C code segment:

int IsPrime(n)
{
  int i,n;
  for(i=2;i<=sqrt(n);i++)
     if(n%i == 0)
      {printf(“Not Primen”); return 0;}
  return 1;
}

Let T(n) denotes the number of times the for loop is executed by the program on input n. Which of the following is TRUE? (A) T(n) = O(sqrt(n)) and T(n) = \Omega(sqrt(n)) (B) T(n) = O(sqrt(n)) and T(n) = \Omega(1) (C) T(n) = O(n) and T(n) = \Omega(sqrt(n)) (D) None of the above
A
T(n) = O(√n) and T(n) = Ω(√n)
B
T(n) = O(√n) and T(n) = Ω(1)
C
T(n) = O(n) and T(n) = Ω(√n)
D
None of the above
Algorithms Time-Complexity GATE 2007 CS
Question 267
Consider the relation employee(name, sex, supervisorName) with name as the key. supervisorName gives the name of the supervisor of the employee under consideration. What does the following Tuple Relational Calculus query produce?


 
A
Names of employees with a male supervisor.
B
Names of employees with no immediate male subordinates
C
Names of employees with no immediate female subordinates.
D
Names of employees with a female supervisor
DBMS GATE 2007 CS
Question 268
Consider that B wants to send a message m that is digitally signed to A. Let the pair of private and public keys for A and B be denoted by Kx- and Kx+ for x = A,B, respectively. Let Kx(m)  represent the operation of encrypting m with a key Kx and H(m) represent the message digest. Which one of the following indicates the CORRECT way of sending the message m along with the digital signature to A?
A
B
C
D
operating systems gate 2016 set 1
© 2024 - All rights are reserved- AAIC Technologies pvt ltd