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 05
1. Which of the following is a linear data structure?
(a) Queue
(b) Stack
(c) Linked list
(d) All of the above
2. Which of the following code snippets deletes the element pointed to by X from the doubly linked list, if it is assumed that X points to the first element of the list and start pointer points to beginning of the list?
(a) X → back = X → front;
X → front = X → back;
(b) start = X → front;
X → back = NULL;
(c) start = X → front;
X → back = NULL;
(d) X → back → back = X → back;
X → front → front = X → front;
3. Which of the following functions should be called at first if you would like to insert an element onto the stack?
(a) isEmpty()
(b) isFull()
(c) Both (a) and (b)
(d) None of the above
4. Average case running time of Bubble sort is ______ .
(a) O(n)
(b) O(log n)
(c) O(n log n)
(d) O(n2)
5. Evaluate the prefix expression: * - + 435 / + 2 4 3
(a) 8
(b) 4
(c) 32
(d) 16
6. We refer the situation where several elements are competing for same bucket in the hash table as,
(a) Diffusion
(b) Replication
(c) Collision
(d) Competition
7. Which of the following is the prefix notation of the expression AB+CD-*?
(a) (A+B)*(C-D)
(b) *+AB-CD
(c) +*AB-CD
(d) -CD*+AB
8. What is the worst case running time of quicksort?
(a) O(n)
(b) O(log n)
(c) O(nlog n)
(d) O(n2)
9. Evaluate the postfix expr 6 5 2 3+8*+3+*
(a) 220
(b) 244
(c) 288
(d) None of the above
10. Recursion is memory-intensive because
(a) Recursive functions tend to declare many local variables.
(b) Previous function calls are still open when the function calls itself and the activation records of these previous calls still occupy space on the call stack.
(c) Many copies of the function code are created.
(d) It requires large data values.
Answer:
1 – (d), 2 – (c), 3 – (b), 4 – (d), 5 – (b), 6 – (c), 7 – (b), 8 – (d), 9 – (c), 10 – (b)
No comments:
Post a Comment