0% found this document useful (0 votes)
18 views3 pages

Sample Questions 2-1

Uploaded by

ayushnair873
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Sample Questions 2-1

Uploaded by

ayushnair873
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

The solution of the recurrence relation of

(A) O(n2)

(B) O(nlg n)

(C) O(n)

(D) O(l g n)

2. How many PUSH and POP operations will be needed to evaluate the following expression by
reverse polish notation in a stack machine (A * B) + (C * D/E) ?
(A) 4 PUSH and 3 POP instructions
(B) 5 PUSH and 4 POP instructions
(C) (C) 6 PUSH and 2 POP instructions
(D) (D) 5 PUSH and 3 POP instructions

3. Convert the following infix expression into its equivalent post fix expression
(A + B^ D) / (E – F) + G

(A) ABD^ + EF – / G+
(B) ABD + ^EF – / G+
(C) ABD + ^EF / – G+
(D) ABD^ + EF / – G+

4. You have to sort a list L, consisting of a sorted list followed by a few ‘random’ elements. Which
of the following sorting method would be most suitable for such a task ?
(A) Bubble sort
(B) Selection sort
(C) Quick sort
(D) (D) Insertion sort

5. Consider an array A[20, 10], assume 4 words per memory cell and the base address of array A
is 100. What is the address of A[11, 5] ? Assume row major storage.
(A) 560
(B) 565
(C) 570
(D) 575

6. A full binary tree with n leaves contains


(A) n nodes (B) log2 n nodes (C) 2n –1 nodes (D) 2 2 nodes
7. Dijkstra algorithm, which solves the single-source shortest--paths problem, is a ................, and
the Floyd-Warshall algorithm, which finds shortest paths between all pairs of vertices, is a
...............
(A) Greedy algorithm, Divide-conquer algorithm
(B) Divide-conquer algorithm, Greedy algorithm
(C) Greedy algorithm, Dynamic programming algorithm
(D) Dynamic programming algorithm, Greedy algorithm

8. Suppose that we have numbers between 1 and 1000 in a binary search tree and we want to
search for the number 365. Which of the following sequences could not be the sequence of
nodes examined ?
(A) 4, 254, 403, 400, 332, 346, 399, 365
(B) 926, 222, 913, 246, 900, 260, 364, 365
(C) 927, 204,913, 242, 914, 247, 365
(D) 4, 401, 389, 221, 268, 384, 383, 280, 365

9. Level order Traversal of a rooted Tree can be done by starting from root and performing:
(A) Breadth First Search (B) Depth first search (C) Root search (D) Deep search

10. The average case occurs in the Linear Search Algorithm when:
(A) The item to be searched is in some where middle of the Array
(B) The item to be searched is not in the array
(C) The item to be searched is in the last of the array
(D) The item to be searched is either in the last or not in the array

11. To determine the efficiency of an algorithm the time factor is measured by:
(A) Counting micro seconds
(B) Counting number of key operations
(C) Counting number of statements
(D) Counting kilobytes of algorithm

12. An all-pairs shortest-paths problem is efficiently solved using:


(A) Dijkstra' algorithm (B) BellmanFord algorithm (C) Kruskal Algorithm (D) Floyd-Warshall
algorithm

13. The in-order traversal of the following tree is:

(A) 2 3 4 6 7 13 15 17 18 18 20
(B) 20 18 18 17 15 13 7 6 4 3 2
(C) 15 13 20 4 7 17 18 2 3 6 18
(D) 2 4 3 13 7 6 15 17 20 18 18
14. In general, in a recursive and non-recursive implementation of a problem (program):

(A) Both time and space complexities are better in recursive than in nonrecursive program
(B) Both time and space complexities are better in non-recursive than in recursive program
(C) Time complexity is better in recursive version but space complexity is better in non-
recursive version of the program
(D) Space complexity is better in recursive version but time complexity is better in non-
recursive version of the program

15. Consider the following binary search tree:


If we remove the root node, which of the node from the left sub-tree will be the new root?

(A) 11 (B) 12 (C) 13 (D) 16

You might also like