Time Left - 12:00 mins

Practice Quiz-3: Data Structures

Attempt now to get your rank among 526 students!

Question 1

We can perform operation like insert, delete, concatenate and rearrange substrings in…………

Question 2

A queue is implemented using a non-circular singly linked list. The queue has a head pointer and tail pointer, as shown in the figure. Let n denote of the number of nodes in the queue. Let enqueue be implemented by interesting a new node at the head and dequeue be implemented by deletion of a node from the tail.

Which one of the following is the time complexity of the most time-efficient implementation of enqueue and dequeue, respectively, for this data structure?

Question 3

Consider the following code which is being implemented on a binary tree :
void ABC(struct Node* node)

{

  if (node==NULL)

          return;

  else

  {

          struct Node* temp;

          ABC(node->left);

          ABC(node->right);

          temp = node->left;

          node->left = node->right;

          node->right = temp;

  }

}

 
What does the code is performing on the binary tree ?

Question 4

In a connected graph, a bridge is an edge whose removal disconnects a graph. Which one of the following statements is true?

Question 5

If the values p, q, r, s and t are pushed onto the stack in the given order, then identity the invalid stack permutation for the given input sequence.

Question 6

Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?

Question 7

What is the value returned by the following function when x=1 and y=3?
int f (int x, int y)
{
if(x==0 && y>=0) return y + 1;
else if (x > 0 && y== 0) return f(x-1,1);
else if (x > 0 && y>0) return (f(x-1, f(x, y-1)));
}

Question 8

What is the number of additions in the Fibonacci series of n which uses following recursive function.
fib(n) = fib(n-1) + fib(n-2)

Question 9

The following function computes XY for positive integers X and Y.
int exp (int X, int Y) {
int res = 1, a = X, b = Y;
while ( b != 0 ){
if ( b%2 == 0) { a = a*a; b = b/2; }
else { res = res*a; b = b-1; }
}
return res;
}
Which one of the following conditions is TRUE before every iteration of the loop?

Question 10

Consider the following c program.
#include<stdio.h>
int main ()
{
Char GATE [10] =”GATE18”;
Char * GRADE;
GRADE=GATE+4;
*GRADE=’0’;
printf (“%s”,GATE );
}
What output is printed by above program?
  • 526 attempts
  • 0 upvotes
  • 1 comment
Dec 21GATE & PSU CS