31.
Consider the problem of a chain <A

_{1}, A_{2}, A_{3}, A_{4}> of four matrices. Suppose that the dimensions of the matrices A_{1}, A_{2}, A_{3}and A_{4}are 30 × 35, 35 × 15, 15 × 5 and 5 × 10 respectively. The minimum number of scalar multiplications needed to compute the product A_{1}A_{2}A_{3}A_{4}is ................
(A) 14875 (B)
21000

(C) 9375 (D)
11875

Answer: C

32.
Consider a hash table of size m = 10000, and
the hash function h(K)=floor(m(KAmod1)) for A = (√5 – 1)/2. The key 123456 is
mapped to location ...............

(A) 46 (B)
41

(C) 43 (D)
48

Answer: B

33.
Consider a weighted complete graph G on the
vertex set {v

_{1}, v_{2}, …. v_{n}} such that the weight of the edge (v_{i}, v_{j}) is 4 |i – j|. The weight of minimum cost spanning tree of G is:
(A) 4n

^{2}(B) n
(C) 4n – 4 (D)
2n – 2

Answer: C

34.
A priority queue is implemented as a
max-heap. Initially, it has five elements. The level-order traversal of the
heap is as follows:

20, 18, 15, 13, 12

Two new elements ‘10’ and ‘17’ are inserted
in the heap in that order. The level-order traversal of the heap after the
insertion of the element is:

(A) 20, 18, 17, 15, 13, 12, 10

(B) 20, 18, 17, 12, 13, 10, 15

(C) 20, 18, 17, 10, 12, 13, 15

(D) 20, 18, 17, 13, 12, 10, 15

Answer: D

35.
If there are n integers to sort, each integer
has d digits, and each digit is in the set
{1, 2, …, k}, radix sort can sort the numbers in:

(A) O (k (n + d)) (B) O (d (n + k))

(C) O ((n + k) l g d) (D) O ((n + d) l g k)

Answer: B

36.
Match the following:

a. Prim’s algorithm i. O(V

^{2}E)
b. Bellman-Ford algorithm ii. O(VE lgV)

c. Floyd-Warshall algorithm iii. O(E lgV)

d. Johnson’s algorithm iv. O(V

^{3})
Where V is the set of nodes and E is the set
of edges in the graph.

**Codes :**

a b c d

(A) i iii iv
ii

(B) i iii ii
iv

(C) iii i iv ii

(D) iii i ii iv

Answer: C

37.
Constructors have ............. return type.

(A) void (B)
char

(C) int (D)
no

Answer: D

38.
Method over-riding can be prevented by using
final as a modifier at ...............

(A) the start of the class.

(B) the start of method declaration.

(C) the start of derived class.

(D) the start of the method declaration in
the derived class.

Answer: B

39.
Which of the following is a correct statement?

(A) Composition is a strong type of
association between two classes with full ownership.

(B) Composition is a strong type of
association between two classes with partial ownership.

(C) Composition is a weak type of association
between two classes with partial ownership.

(D) Composition is a weak type of association
between two classes with strong ownership.

Answer: A

40.
Which of the following is not a correct
statement?

(A) Every class containing abstract method
must be declared abstract.

(B) Abstract class can directly be initiated
with ‘new’ operator.

(C) Abstract class can be initiated.

(D) Abstract class does not contain any
definition of implementation.

Answer: B

## 0 Comments