# Data structures and algorithms multiple choice questions with answers, important interview questions in data structures, data structures questions for entrance exams

__Data Structures and Algorithms Multiple Choice Questions __

__SET 03__

1. Which data structure represents a waiting line and limits insertions to be made at the back of the data structure and limits removals to be made from the front?

(a) Stack.

(b) Queue.

(c) Binary tree.

(d) Linked list.

2. What is the in-order traversal of the following binary tree?

(a) Q M H F G P S R W U

(b) G F H P M R U W S Q

(c) F G H M P Q R S U W

(d) None of the above

3. n^{3/2}
is

(a)
O(n^{2})

(b) O(nlog n)

(c) Θ(n^{2})

(d) Ω(n)

4. Assume A is an array-based tree with 70 nodes. What is the index of the first leaf node?

(a) 70

(b) 35

(c) 17

(d) None of the above

5. Given a
collection of algorithms that runs on O(1), O(n log n), O(n), O(n^{2}),
O(log n), O(n!), order the algorithms from fastest to slowest.

(a) O(1), O(n log
n), O(n), O(n^{2}), O(log n), O(n!)

(b)
O(1), O(log n), O(n), O(n log n), O(n^{2}), O(n!)

(c) O(1), O(log n),
O(n log n), O(n), O(n^{2}), O(n!)

(d) None of the above

6. Finding the max element in an unordered stack would require

(a) O(1) operations

(b) O(log n) operations

(c) O(n) operations.

(d) None of the above

7. What is the complexity of determining all duplicates in a sorted singly linked list?

(a) O(n)

(b) O(n^{2})

(c) O(n!)

(d) O(n log n)

8. What is the complexity of algorithm that is determining all possible paths between n cities?

(a) O(n)

(b) O(n^{2})

(c) O(n!)

(d) O(n log n)

9. What is the output of the following code if the values of a and b are 3 and 9 respectively?

public int foo(int a, int b)

{

if (a%b == 0)

return b;

else

return foo(b, a%b);

}

(a) 1

(b) 3

(c) 6

(d) 9

10. Which is the best data structure to implement the following?

“A list must be maintained so that any element can be accessed randomly”

(a) Queue

(b) Array

(c) Stack

(d) All of the above

__Answer:__

**1 – (b), 2 – (c), 3 – (a) & (d), 4 – (b), 5
– (b), 6 – (c), 7 – (d), 8 – (c), 9 – (b), 10 – (b)**

###
**Related links:**

**Related links:**