0% found this document useful (0 votes)
23 views13 pages

Data Structure 50 MCQs With Answers

The document contains 50 multiple-choice questions (MCQs) related to data structures, covering topics such as stacks, queues, binary trees, sorting algorithms, and graph theory. Each question is followed by the correct answer, providing a comprehensive overview of fundamental concepts in data structures. This resource is useful for students and professionals preparing for exams or enhancing their knowledge in computer science.

Uploaded by

vinitganesh4
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)
23 views13 pages

Data Structure 50 MCQs With Answers

The document contains 50 multiple-choice questions (MCQs) related to data structures, covering topics such as stacks, queues, binary trees, sorting algorithms, and graph theory. Each question is followed by the correct answer, providing a comprehensive overview of fundamental concepts in data structures. This resource is useful for students and professionals preparing for exams or enhancing their knowledge in computer science.

Uploaded by

vinitganesh4
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

50 Data Structure MCQs with Answers

Q1. Stack is a ____ in data structure concept.

(A) Basic data type

(B) Derived data type

(C) Abstract data type

(D) Primitive data type

Answer: Abstract data type

Q2. In a stack, insertion and deletion follow which order?

(A) FIFO

(B) LIFO

(C) Random

(D) Priority

Answer: LIFO

Q3. Which data structure is most natural to implement recursion?

(A) Queue

(B) Stack

(C) Array

(D) Linked list

Answer: Stack

Q4. Which data structure is used in Breadth-First Search (BFS) of a graph?

(A) Stack

(B) Queue

(C) Heap

(D) Deque
Answer: Queue

Q5. Which is typically used for Depth-First Search (DFS)?

(A) Queue

(B) Heap

(C) Stack

(D) Hash table

Answer: Stack

Q6. A binary tree with n nodes has how many edges?

(A) n

(B) n+1

(C) n-1

(D) n-2

Answer: n-1

Q7. For a full binary tree with 2n+1 total nodes, the number of leaf nodes is:

(A) n

(B) n+1

(C) 2n

(D) 2n+1

Answer: n+1

Q8. The maximum number of nodes at level l of a binary tree is:

(A) 2^l

(B) l^2

(C) 2l

(D) l!
Answer: 2^l

Q9. The worst-case height of a binary tree with n nodes is:

(A) log2(n)

(B) n

(C) n/2

(D) sqrt(n)

Answer: n

Q10. Which traversal order is Root Left Right?

(A) Inorder

(B) Preorder

(C) Postorder

(D) Level order

Answer: Preorder

Q11. In a simple graph with n vertices, maximum possible degree of a vertex is:

(A) n

(B) n-1

(C) n+1

(D) 2n-1

Answer: n-1

Q12. A graph G = (V, E) means:

(A) V=variables, E=edges

(B) V=vertices, E=edges

(C) V=vertices, E=equations

(D) V=values, E=edges


Answer: V=vertices, E=edges

Q13. Which algorithm finds single-source shortest path for nonnegative weights?

(A) Kruskal

(B) Prim

(C) Bellman-Ford

(D) Dijkstra

Answer: Dijkstra

Q14. Which algorithm is used to compute a Minimum Spanning Tree (MST)?

(A) Dijkstra

(B) Bellman-Ford

(C) Kruskal

(D) Binary search

Answer: Kruskal

Q15. Which traversal uses a queue?

(A) DFS

(B) BFS

(C) Topological sort

(D) Dijkstra

Answer: BFS

Q16. Merge sort follows which strategy?

(A) Divide and conquer

(B) Greedy

(C) Dynamic programming

(D) Backtracking
Answer: Divide and conquer

Q17. Quick sort uses:

(A) Divide and conquer

(B) Greedy

(C) Backtracking

(D) Dynamic programming

Answer: Divide and conquer

Q18. Which has the best average-case complexity?

(A) Bubble sort

(B) Selection sort

(C) Merge sort

(D) Insertion sort

Answer: Merge sort

Q19. Which searching algorithm requires a sorted array?

(A) Linear search

(B) Binary search

(C) Hash search

(D) DFS

Answer: Binary search

Q20. Heap sort is based on:

(A) Queue

(B) Stack

(C) Heap

(D) Graph
Answer: Heap

Q21. Collision resolution by chaining uses:

(A) Array

(B) Linked list

(C) Stack

(D) Binary tree

Answer: Linked list

Q22. Load factor in hashing is:

(A) n+m

(B) n/m

(C) m/n

(D) n*m

Answer: n/m

Q23. Which is open addressing?

(A) Chaining

(B) Linear probing

(C) Separate chaining

(D) Bucket hashing

Answer: Linear probing

Q24. Best-case lookup in hashing is:

(A) O(1)

(B) O(log n)

(C) O(n)

(D) O(n log n)


Answer: O(1)

Q25. Double hashing is used to:

(A) Increase load factor

(B) Resolve collisions

(C) Sort keys

(D) Compress data

Answer: Resolve collisions

Q26. Which is NOT a linked-list type?

(A) Singly linked

(B) Doubly linked

(C) Circular linked

(D) Indexed linked

Answer: Indexed linked

Q27. Which linked list allows both forward & backward traversal?

(A) Singly linked

(B) Circular

(C) Doubly linked

(D) Sentinel

Answer: Doubly linked

Q28. Which is efficient for sparse polynomials?

(A) Array

(B) Linked list

(C) Stack

(D) Queue
Answer: Linked list

Q29. Which operation is costly in arrays compared to linked lists?

(A) Traversal

(B) Insertion

(C) Indexing

(D) Direct access

Answer: Insertion

Q30. Which linked list is best for queues?

(A) Singly linked (no tail)

(B) Circular linked

(C) Doubly linked (no tail)

(D) Array

Answer: Circular linked

Q31. Binary search time complexity:

(A) O(1)

(B) O(n)

(C) O(log n)

(D) O(n log n)

Answer: O(log n)

Q32. Linear search time complexity:

(A) O(1)

(B) O(log n)

(C) O(n)

(D) O(n^2)
Answer: O(n)

Q33. Which sort is not stable?

(A) Bubble sort

(B) Merge sort

(C) Quick sort

(D) Insertion sort

Answer: Quick sort

Q34. Worst-case complexity of Quick sort:

(A) O(n)

(B) O(log n)

(C) O(n log n)

(D) O(n^2)

Answer: O(n^2)

Q35. Which has O(1) access by index?

(A) Stack

(B) Queue

(C) Array

(D) Linked list

Answer: Array

Q36. Which is a non-linear data structure?

(A) Array

(B) Linked list

(C) Stack

(D) Tree
Answer: Tree

Q37. Which is linear?

(A) Tree

(B) Graph

(C) Stack

(D) Binary tree

Answer: Stack

Q38. Traversal yielding postfix from expression tree?

(A) Preorder

(B) Inorder

(C) Postorder

(D) Level order

Answer: Postorder

Q39. Traversal yielding prefix from expression tree?

(A) Preorder

(B) Inorder

(C) Postorder

(D) Level order

Answer: Preorder

Q40. Priority queue is efficiently implemented with:

(A) Stack

(B) Array

(C) Heap

(D) Linked list


Answer: Heap

Q41. Minimum edges in connected graph with n vertices:

(A) n

(B) n-1

(C) 2n

(D) n+1

Answer: n-1

Q42. A BST is:

(A) Complete tree

(B) Balanced tree

(C) Ordered tree

(D) Heap

Answer: Ordered tree

Q43. AVL tree is:

(A) Unbalanced

(B) Balanced BST

(C) Heap

(D) Graph

Answer: Balanced BST

Q44. B-trees are used in:

(A) OS internals

(B) Databases

(C) Compilers

(D) Networks
Answer: Databases

Q45. Undo in text editors uses:

(A) Queue

(B) Stack

(C) Linked list

(D) Heap

Answer: Stack

Q46. Traversal giving sorted order in BST:

(A) Preorder

(B) Inorder

(C) Postorder

(D) Level order

Answer: Inorder

Q47. Efficient LRU cache uses:

(A) Queue only

(B) Hash table + Doubly linked list

(C) Stack + Array

(D) Binary tree + stack

Answer: Hash table + Doubly linked list

Q48. Disjoint Set Union supports:

(A) Insert & delete

(B) Push & pop

(C) Find & union

(D) Enqueue & dequeue


Answer: Find & union

Q49. Cycle detection in directed graph often uses:

(A) BFS level order

(B) DFS with recursion stack

(C) Dijkstra

(D) Kruskal

Answer: DFS with recursion stack

Q50. Space complexity of adjacency matrix of graph with n vertices:

(A) O(n)

(B) O(n log n)

(C) O(n^2)

(D) O(1)

Answer: O(n^2)

You might also like