# 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 04__

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

“A program needs to remember operations it performed in opposite order”

(a) Queue

(b) Array

(c) Stack

(d) All of the above

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

“A list must be maintained so that elements can be added to the beginning or end in O(1)”

(a) Queue

(b) Array

(c) Linked List

(d) Circular DLL

3. Worst case running time for searching an element in binary search tree is ________ .

(a) O(n)

(b) O(log n)

(c) O(n log n)

(d) O(n^{2})

4. How may NULL pointers are there in a circular doubly linked list?

(a) 3

(b) 1

(c) 2

(d) 0

5. Evaluate the postfix expression: 6 2 3 + - 3 8 2 / + * 2 ^ 4 +

(a) 52

(b) 26

(c) 25

(d) 53

6. ______ function allocates memory dynamically to a data structure during execution.

(a) calloc()

(b) malloc()

(c) dalloc()

(d) allocate()

7. Array data structures are efficient for _________ .

(a) Sequential access

(b) Element rearranging

(c) Both (a) and (b)

(d) None of the above

8. Which of the following is correct for ascending order of time complexities? [low to high time complexity]

(a) O(1), O(nlog
n), O(n^{2}), O(2^{n})

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

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

(d) All of the above

9. Which of the following is used to define the worst-case running time of an algorithm?

(a) Big-oh notation

(b) Big-omega notation

(c) Small-oh notation

(d) Big-theta notation

10. ______ of an algorithm is the amount of time (or the number of steps) needed by a program to complete its task.

(a) Space Complexity

(b) Dynamic programming

(c) Time complexity

(d) Divide and conquer

__Answer:__

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

###
**Related links:**

**Related links:**