1 |
The arguments passed to a function should match in number, type and order with the parameters in the function
definition. |
True
False
both
|
2 |
Merge sort makes two recursive calls,which statement is true after these recursive calls,finish but before the merge step? |
Elements in the first half of the array are less than or equal to elements in the second half of the array
None of the given options
The array elements form a heap.
Elements in the second half of the array are less than or equal to elements in the first half of the array
|
3 |
The _______ method of list will position the currentNode and lastCurrentNode at the start of the list. |
Remove
Next
Start
Back
|
4 |
What is the formula of approixation for the depth of a heap with n nodes? |
log (base 2) of n
The number of digits in n (base 10 )e,g 145 has three digit
The square root of n
n
|
5 |
Which of the following is not true regarding the maze generation ? |
Randomly remove walls until the entrance and exit cells are in same set
Removing a wall is the same as doing union of operation
Removing a randomly chosen wall if the cell is separatedare already in the same set
Do not remove a randomly chosen wall if the cells it separates are already in the same set.
|
6 |
Suppose you implement a Min heap (with the smallest element on top) in an array. Consider the different arrays
below; determine the one that cannot possibly be a heap: |
16, 18, 20, 22, 24, 28, 30
16, 20, 18, 24, 22, 30, 28
16, 24, 18, 28, 30, 20, 22
16, 24, 20, 30, 28, 18, 22
|
7 |
A binary tree with 33 internal nodes has _______ links to internal nodes.
|
31
32
33
66
|
8 |
Suppose we are sorting an array of eight integers using quick sort, and we have just finished the first
partitioning with the array looking like this:
2 5 1 7 9 12 11 10
Which statement is correct? |
The pivot could be either the 7 or the 9
The pivot could be the 7, but it is not the 9.
The pivot is not the 7, but it could be the 9.
Neither the 7 nor the 9 is the pivot.
|
9 |
If both pointers of the node in a binary tree are NULL then it will be a/an _______ . |
Inner node
Leaf node
Root node
None of the given options
|
10 |
If there are N elements in an array then the number of maximum steps needed to find an element using Binary
Search is _______ . |
N
N<sup>2</sup>
Nlog<sub>2</sub>N
log<sub>2</sub>N
|
11 |
In a perfectly balanced tree the insertion of a node needs ________ . |
One rotation
Two rotations
Rotations equal to number of levels
No rotation at all
|
12 |
Consider te following array
23 15 5 12 40 10 7
After the first pass of a particular algorithm, the array looks like
15 5 12 23 10 7 40
Name the algorithm used |
Heap sort
Selection sort
Insertion sort
Bubble sort (
|
13 |
There is/are ________ case/s for rotation in an AVL tree, |
1
2
3
4
|
14 |
Which one is a self-referential data type? |
Stack
Queue
Link list
All of these
|
15 |
If a max heap is implemented using a partially filled array called data, and the array contains n elements (n >
0), where is the entry with the greatest value? |
Data[0]
data[1]
data[n-1]
data[n]
|
16 |
If a complete binary tree has height h then its no. of nodes will be, |
Log (h)
2<sup>h</sup>+1
- 1
Log (h) - 1
2<sup>h</sup> - 1
|
17 |
If you know the size of the data structure in advance, i.e., at compile time, which one of the following is a good
data structure to use. |
Array
List
Both
None of the above
|
18 |
Each node in a double link list has , |
1 pointer
2 pointer
3 pointer
4 pointers
|
19 |
A binary tree with N internal nodes has ____ links ,links to internal node and ____links to external |
N+1, 2N, N-1
N+1, N-1, 2N
2N, N-1, N+1
N-1, 2N, N+1
|
20 |
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.
x is now 1 but y is still 0
x is still 0,but y is now 2
x is now1 1 and y is now 2
|