You are on page 1of 8

In order traversal of a binary tree = d b e a f c g

Pre order traversal of binary tree = a b d e c f g

Choose the post order traversal of the binary tree.

1. debfgca

2. edbgfca

3. edbfgca

4. defgbca

Question 4 of 24
|

A priority queue is implemenented as a max Heap. Initially, it has 5 elements. The level order
traversal of the heap is given below.

10, 8, 5, 3, 2

Two new elements 1 and 7 are inserted in the heap in that order. The level order traversal of
the heap after the insertion of the elements is

1. 10, 8, 7, 5, 3, 2, 1

2. 10, 8, 7, 2, 3, 1, 5

3. 10, 8, 7, 2, 1, 3, 5

4. 10, 8, 7, 3, 2, 1, 5
A set x can be represented by an array x [n] as follows.

Consider the following algorithm in which x, y and z are Boolean arrays of size n.

Algorithm zzz (x [ ], y [ ], z [ ])

int i ;

For (i = 0; I<n;+ + i)

z (i) = [(x(i) ~ Y(i)] v (~ x[i] ^ y(i)]

The set Z computed by the algorithm is

1. (X Intersection Y)

2. (X Union Y)

3. (X Y) Intersection (Y X)

4. (X Y) Union (Y X)

Question 9 of 24
|

Suppose the elements 7, 2, 10 and 4 are inserted, in that order, into the valid 3-ary mass heap
found in the above question, which one of the following is the sequence of items in the array
representing the resultant heap?

1. 10, 7, 9, 8, 3, 1, 5, 2, 6, 4

2. 10, 9, 8, 7, 6, 5, 4, 3, 2, 1

3. 10, 9, 4, 5, 7, 6, 8, 2, 1, 3
4. 10, 8, 6, 9, 7, 2, 3, 4, 1, 5

Question 10 of 24
|

Suppose one is given array s [ 1n] and a procedure reverse (s, i, j), which reverses the order of
elements in a between position i and j (both inclusive). What does the following sequence
do? Where 1 < k < = n:Reverse (s, 1, k);Reverse (s, k + 1), n:Reverse (s, i, n);

1. Rotates 5 left by k positions

2. Leaves s unchanged

3. Reverses all elements of s

4. None of the above

Consider a binary max heap implemented using an array given below.

Which one of the above array represents a binary max heap?

1. 25, 12, 16, 13, 10, 8, 14

2. 25, 14, 13, 16, 10, 8, 12

3. 25, 14, 16, 13, 10, 8, 12

4. 25, 14, 12, 13, 10, 8, 16


The following sequence of keys is produced as the result of post order traversal of a given BST Q,

10 9 23 22 27 25 15 50 95 60 40 29

From the options below, which one of the sequences can be due to in order traversal of the BST Q?

1. 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95

2. 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29

3. 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95

4. 95, 50, 60, 40, 27, 22, 23, 25, 10, 9, 15, 29

The maximum number of binary trees that can be formed with three unlabeled nodes is

1. 1

2. 5

3. 4

4. 3
Question 17 of 24
|

Given are the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173 and 4199) and the hash
function x mod 10, which of the following statements are true?

i. 9679, 1989, 4199 hash to the same value

ii. 1471, 6171 hash to the same value

iii. All elements hash to the same value

iv. Each element hashes to a different value

1. i only

2. ii only

3. i and ii only

4. iii or iv

Question 18 of 24
|

What is the memory requirement for double declaration?

1. 2 bytes

2. 4 bytes

3. 1 byte

4. 8 bytes

Which of the following sorting algorithms has the lowest worstcase complexity?

1. Merge sort
2. Bubble sort

3. Quick sort

4. Selection sort

Question 21 of 24
|
The following postfix expression with single digit operands is evaluated using a stack

823^/23*+51*^

Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is
evaluated are

1. 6, 1

2. 5, 7

3. 3, 2

4. 1, 5

Question 22 of 24
|

For referring the element a[I][j][k][l], the equivalent pointer expression is

1. *(a+I+j+k+l)

2. *(*(*(*(a+i)+j)+k)+l)

3. and(a+I+j+k+l)

4. *((((a+I)+j)+k)+l)

Question 23 of 24
|

The easiest sorting method to use is

1. binary sort

2. radix sort

3. quick sort

4. bubble sort

You might also like