1 |
Which of the following statement is NOT true about find operation : |
It is not a requirement that a find operation returns any specific name, just that finds on two elements
return the same answer if and only if they are in the same set.
One idea might be to use a tree to represent each set, since each element in a tree has the same
root, thus the root can be used to name the set.
Initially each set contains one element.
initially each set contains one element and it does not make sense to make a tree of one node only.
|
2 |
Which of the following statement is true about find(x) operation : |
A find(x) on element x is performed by returning exactly the same node that is found.
A find(x) on element x is performed by returning the root of the tree containing x.
A find(x) on element x is performed by returning TRUE.
A find(x) on element x is performed by returning the whole tree itself containing x
|
3 |
Which of the following algorithm is most widely used due to its good average time |
Bubble sort
insertion sort
quick sort
merge sort
|
4 |
Consider a min heap, represented by the following array:
3,4,6,7,5,10
After inserting a node with value 1.Which of the following is the updated min heap? |
3,4,6,7,5,10,1
3,4,6,7,5,1,10
3,4,1,5,7,10,6
1,4,3,5,7,10,6close to correct but correct ans is 1,4,3,7,5,10,6
|
5 |
A complete binary tree of height 3 has between _____ node |
8-14
8-15
8-16
8-17
|
6 |
By using _____ we avoid recursive method of traversing a tree,which makes use of stacks and consumes a lot of memory and time. |
Binary tree only
Threaded binary tree
Heap data structure
Huffman encoding
|
7 |
If both pointers of the node in a binary trees are NULL then it will be a___ |
Inner node
Leaf node
Root node
None of the above
|
8 |
Consider te following array
23 15 5 12 40 10 7
After the first pass of a particular algorithm, the array looks like
15 12 23 10 7 40
Name the algorithm used |
Heap sort
Selection sort
insertion sort
Bubble sort
|
9 |
If there are N elements in an array then the number of maximum steps needed to find an elements using Binary Search is __________ |
N
N<sup>2</sup>
Nlog2N
log<sub>2</sub>N
|
10 |
A binary tree of N nodes has _____ |
Log<sub>10</sub>N Levels
Log<sub>2</sub> N levels
N/2 Levels
N X2 Levels
|
11 |
The definition of transitive property is |
For all element x member of S, x R x
For all elements x and y, x R y if and only if y R x
For all elements x, y and z, if x R y and y R z then x R z
For all elements w, x, y and z, if x R y and w R z then x R z
|
12 |
Which of the following method is helpful in creating the heap at once? |
insert
add
update
preculateDown
|
13 |
If there are 23 external nodes in a binary tree then what will be the no. of internal nodes in this binary tree? |
23
24
21
22 (n-1)
|
14 |
If there are 56 internal nodes in a binary tree then how many external nodes this binary tree will have? |
54
55
56
57
|
15 |
Compiler uses which one of the following to evaluate a mathematical equation |
Binary Tree
Binary Search Tree
Parse Tree
AVL Tree
|
16 |
The difference between the binary tree and a binary search tree is that:
|
a binary search tree has two children per node whereas a binary tree can have none, one, or two
children per node
in binary search tree nodes are inserted based on the values they contain
in binary tree nodes are inserted based on the values they contain
none of these
|
17 |
Here is a small function definition: void f(int i, int &k) {
i = 1;
k = 2; } Suppose that a main program has two integer variables x and y, which are given the value 0. Then the main
program calls f(x,y); What are the values of x and y after the function f finishes? |
Both x and y are still 0.
Both x and y are still 0.
x is still 0, but y is now 2.
x is now 1, and y is now 2.
|
18 |
A compound data structure is the data structure which can have multiple data items of same type or of different types,which of the following can be considered compound data structure ? |
Arrays
LinkLists
Binary Search Trees
All of the given options
|
19 |
Suppose currentNode refers to a node in a linked list(using the Node class with member variables called data and next node),What statement changes currentNode so that it refers to the next node? |
currentNode ++;
currentNode = nextNode;
currentNode += nextNode;
currentNode = currentNode->nextNode;
|
20 |
If numbers 5,222,4,48 are inserted in queue,which one will be removed first? |
48
4
222
5
|