Time Left - 12:00 mins

UGC-NET 2018: ( Data Structure & Algorithms ) SpeedTest Quiz 6

Attempt now to get your rank among 547 students!

Question 1

Which of the following defines the referencing environment.

Question 2

import static java.lang.Math.pow;
class demo
{
static double cube1(Double x)
{
x=new Double(Math.pow(x,3.0));
return (x);
}
static void cube2(Double y)
{
y=new Double(Math.pow(y,3.0));
}
public static void main(String []args)
{
double x=3,y=3;
x=cube1(x);
cube2(y);
System.out.print(x+y);
}
}
What will be printed as output of above code ?

Question 3

#include <iostream>
using namespace std;
class math{
public :
int sum(int a,int b)
{
return a+b;
}
int sum(float a,float b)
{
return c=a+b;
}
};
int main(){
math m;
cout<<m.sum(6.5f,9.5f);
return 0;
}
What will be output of above code ?

Question 4

#include <stdio.h>
void main()
{
int x=25;
int y=!!x;
switch(y)
{
case 0:
printf("number is zero");
break;
case 1:
printf("odd number");
break;
case 10:
printf("even number");
break;
case 25:
printf("correct number");
break;
}
}
What will be output of above code ?

Question 5

An AVL tree is constructed by inserting the following sequence of elements into empty AVL tree. After building an AVL tree, if an element ‘4’ is deleted from it, find how many levels are present in the AVL tree.
7, 4, 9, 5, 4.5, 6, 5.5, 5.2

Question 6

A binary tree enables one to search for and find an element with an average running time f(n) = O(n). This structure is compared with a sorted linear array and linked list. Which of the following statements are correct?
(i) In a sorted linear array one can search for and find an element with a running time f(n) = O (n) but it is expansive to insert and delete elements.
(ii) In a linked list one can easily insert and delete elements, but it is expensive to find an element since one must use a linear search with running time f(n) = O(n).

Question 7

Consider the given graph:

Its Minimum Cost Spanning Tree is:

Question 8

The time complexities of some standard graph algorithms are given.
Match each algorithm with its time complexity ? (n and m are no. of nodes and edges respectively)
List - I
a. Bellman Ford algorithm
b. Kruskals algorithm
c. Floyd Warshall algorithm
d. Topological sorting
List - II
1. O (m log n)
2. O (n3)
3. O(mn)
4. O(n + m)

Question 9

Let, and be asymptotically non-negative functions. Which of the following is correct?

Question 10

An all-pairs shortest-paths problem is efficiently solved using:
  • 547 attempts
  • 0 upvotes
  • 9 comments
Jun 10GATE & PSU CS