MCQs with AnswersAn open book and multiple-choice quiz icon with a green checkmark, alongside the MCQs with Answers wordmark.ABCDMCQsWITH ANSWERS
  • Home
  • FAQs
  • Contact Us

Categories

MCQs with AnswersAn open book and multiple-choice quiz icon with a green checkmark, alongside the MCQs with Answers wordmark.ABCDMCQsWITH ANSWERS
  • Home
  • Privacy Policy
  • DMCA

Copyright © 2026 MCQs with Answers. All rights reserved.

Navigation Menu

Data Structure and Alogrithm MCQs

Data Structure and Alogrithm MCQs

Data Structure and Alogrithm MCQs,data structures and algorithms questions and answers pdf,Data Structures and Algorithms Multiple Choice Questions and Answers pdf,data structure mcqs,Data Structures Algorithms Questions and Answers

86 questions/Oct 11, 2026
Data Structure and Alogrithm MCQs

1. Binary Search can be categorized into which of the following?

(a)Brute Force technique
(b)Divide and conquer
Correct
(c)Greedy algorithm
(d)Dynamic programming

Explanation: Binary search uses divide and conquer by halving the remaining search interval at each step.

2. How do you initialize an array in C?

(a)int int arr[3] = (1,2,3);
(b)int arr(3) = {1,2,3);
(c)int arr[3] = {1,2,3};
Correct
(d)int arr(3) = (1,2,3);

Explanation: In C, an array of three integers can be initialized with braces: int arr[3] = {1, 2, 3};

3. How many passes does an insertion sort algorithm consist of?

(a)N
(b)N-1
Correct
(c)N+1
(d)N2

Explanation: For n elements, insertion sort makes n−1 passes through the unsorted portion in its usual formulation.

4. In a stack, if a user tries to remove an element from empty stack it is called

(a)Underflow
Correct
(b)Empty collection
(c)Overflow
(d)Garbage Collection

Explanation: Removing an item from an empty stack is stack underflow, because no element is available to pop.

5. In binary search, we compare the value with the elements in the. position of the array.*

(a)Left
(b)middle
Correct
(c)Right
(d)None

Explanation: Binary search compares the target with the middle element of the current search interval.

6. In computer science, algorithm refers to a special method usable by a computer for the solution to a problem.*

(a)True
Correct
(b)False

Explanation: An algorithm is a finite, well-defined sequence of steps for solving a problem; computers can execute algorithms to perform tasks.

7. Is following sequence is a fibonacci sequence:0, 1, 1, 2, 3, 5, 8, 13, 21,.

(a)True
Correct
(b)False

Explanation: The Fibonacci sequence starts 0, 1, and each subsequent term is the sum of the previous two terms.

8. Partition and exchange sort is ...

(a)Quick sort
Correct
(b)heap heap sort
(c)bubble sort
(d)None

Explanation: Quick sort is also known as partition-exchange sort because it partitions elements around a pivot and recursively sorts the partitions.

9. Perform based criteria of algorithm, which has to do with computing algorithm called as _________.

(a)Space Complexity
(b)Time Complexity
Correct
(c)Notations
(d)Subtitles/closed captic

Explanation: Time complexity describes how an algorithm's running time grows as input size increases.

10. The complexity of the sorting algorithm measures the.. as a function of the number n of items to be sorter.

(a)Average time
(b)Running time
Correct
(c)Average-case complexity
(d)Case-complexity

Explanation: Sorting algorithm complexity commonly describes how its running time grows with the number n of input items.

11. The element that is going to be searched in a list is called

(a)items
(b)key
Correct
(c)file
(d)table

Explanation: The key (also called the search key or target) is the value being searched for.

12. The following sequence is a fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21,. Which technique can be used to get the nth fibonacci term?

(a)Switch case
(b)Recursion
Correct
(c)Functions calling
(d)Divide & Conquare

Explanation: Recursion can define Fibonacci terms in terms of earlier terms. A naive recursive implementation is inefficient for larger n; iteration or memoization is usually preferable.

13. The given array is arr = {1,2,4,3). Bubble sort is used to sort the array elements.How many iterations will be done to sort the array with improvised version?*

(a)4
(b)2
Correct
(c)1
(d)0

Explanation: Starting with [1, 2, 4, 3], the first bubble-sort pass moves 4 past 3, giving [1, 2, 3, 4]; a second pass confirms no swaps are needed in an optimized version, so two passes/iterations are counted by this question's convention.

14. The Time complexity of bubble sort algorithm is ..

(a)O(n)
(b)o(logn)
(c)O(n2)
Correct
(d)O(n logn)

Explanation: Bubble sort has average- and worst-case time complexity O(n²). An optimized version can run in O(n) on already sorted input.

15. The way in which the data item or items are logically related defines..

(a)storage structure
(b)data structure
Correct
(c)data relationship
(d)data operation

Explanation: A data structure organizes data items and defines how they are related and accessed.

16. The worst-case occur in linear search algorithm when ..

(a)Item is somewhere in the middle of the array
(b)Item is not in the array at all
(c)Item is the last element in the array
(d)Item is the last element in the array or item is not there
Correct

Explanation: Linear search checks elements one by one. Its worst case occurs when the target is last or absent, requiring up to n comparisons.

17. To represent hierarchical relationship between elements, Which data structure is suitable?

(a)Tree
Correct
(b)Graph
(c)Stack
(d)Queue

Explanation: A tree represents hierarchical relationships through parent-child links, making it suitable for hierarchies such as file systems.

18. What is an internal sorting algorithm?

(a)Algorithm that uses tape or disk during the sort
(b)Algorithm that uses main memory during the sort
Correct
(c)Algorithm that involves swapping
(d)Algorithm that are considered 'in place'

Explanation: Internal sorting sorts data held in main memory. Sorting that relies on external storage such as disks or tapes is external sorting; the source's marked answer is reversed.

19. What is the average case time complexity of merge sort? *

(a)O(n log n)
Correct
(b)o(n2)
(c)o(n2 log n)
(d)O(n log n2)

Explanation: Merge sort has O(n log n) average-case time complexity because it divides the input into levels of merging, with linear work per level.

20. What is the process of finding the location of a given data element in the data structure called?

(a)Deletion
(b)Insertion
(c)Traversing
(d)Searching
Correct

Explanation: Searching is the operation of locating a target element or determining whether it exists in a data structure.

21. What is the time complexity of binary search with iteration?

(a)O(nlogn)
(b)O(logn)
Correct
(c)o(n)
(d)O(n2)

Explanation: Iterative binary search takes O(log n) time because the search interval is approximately halved on every iteration.

22. What plays an important role in programming?

(a)Data
Correct
(b)Computer
(c)Frameowrk
(d)None of the Above

Explanation: Data is central to programming because programs process, transform, store, and retrieve data.

23. Which is the fastest searching algorithm?

(a)Linear Search
(b)Binary Search
Correct
(c)Interpolation
(d)None

Explanation: For a sorted array, binary search is generally more efficient than linear search for large inputs, taking O(log n) time. No single search algorithm is fastest in every situation.

24. Which of the following can be used as a criterion for classification of data structures used in language processing?

(a)nature of a data structure
(b)purpose of a data structure
(c)lifetime of a data structure
(d)All of the above
Correct

Explanation: Data structures may be classified by their nature, purpose, and lifetime, so all listed criteria can be used.

25. Which of the following is a stable sorting algorithm?

(a)Merge Sort
Correct
(b)Quick Sort
(c)Heap Sort
(d)Selection Sort

Explanation: Merge sort is stable when implemented in the standard way, preserving the relative order of equal-key elements.

26. Which of the following is non-liner data structure ?

(a)Trees
Correct
(b)Stack
(c)List
(d)Queue

Explanation: Trees are non-linear data structures because nodes can branch into hierarchical relationships rather than forming one sequential list.

27. Which of the following is not the required condition for binary search algorithm?

(a)The list must be sorted
(b)There should be the direct access to the middle element in any sublist
(c)Divide conquare is used
(d)Search sequentially
Correct

Explanation: Binary search requires sorted data and repeatedly examines the middle element; it does not search sequentially through every item.

28. Which of the following is true about merge sort?

(a)Merge Sort works better than quick sort if data is accessed from slow sequential memory.
(b)Merge Sort is stable sort by nature
(c)Merge sort outperforms heap sort in most of the practical situations.
(d)All of the ahove
Correct

Explanation: Merge sort is stable by nature when implemented conventionally and is well suited to sequential-access storage. The source leaves the answer blank; option (d) appears to be the intended answer, but the claim that it outperforms heap sort in most practical situations is not universally true.

29. Which of the following real time examples is based on insertion sort?

(a)Arranging a pack of playing cards
Correct
(b)Database scenarios and distributes scenarios
(c)Arranging books on a library shelf
(d)Oreal-time systems

Explanation: Insertion sort mirrors arranging playing cards: take each new card and insert it into the correct position among the already ordered cards.

30. Which of the following recursive formula can be used to find the factorial of a number?

(a)fact(n) = n * fact(n)
(b)fact(n) = n * fact(n+1)
(c)fact(n) = n * fact(n-1)
Correct
(d)fact(n) = n * fact(1)

Explanation: The recursive factorial relation is fact(n) = n × fact(n−1), with base case fact(0) = 1 (or fact(1) = 1).

31. Which of the following sorting algorith ms is the fastest?

(a)Bubble Sort
(b)Quick Sort
Correct
(c)Merge Sort
(d)Selection Sort

Explanation: Quick sort is often very fast in practice on general arrays, with average O(n log n) time, although its worst case is O(n²).

32. Which of the following sorting algorithms is the fastest for sorting small arrays

(a)Quick sort
(b)Insertion sort
Correct
(c)Shell sort
(d)Heap sort

Explanation: Insertion sort is often excellent for small arrays because it has low overhead and performs well on small or nearly sorted inputs.

33. Before sorting & After sorting location of element is same. This concept is called as

(a)Sort Stability
Correct
(b)Sort Selection
(c)Sorting
(d)None of the above

Explanation: Stability in sorting means equal-key elements retain their relative order; it does not mean every element stays at the same absolute index.

34. Worst case measured by

(a)Big Oh Notation
Correct
(b)Omega Notation
(c)Theta Notation
(d)None

Explanation: Big-O notation provides an asymptotic upper bound and is commonly used to express worst-case time complexity.

35. How can we describe an array in the best possible way?

(a)The Array shows a hierarchical structure
(b)Arrays are immutable
(c)Container that stores the elements of similar types
Correct
(d)The Array is not a data structure

Explanation: An array is a data structure that stores multiple elements of the same data type under a single variable name. Each element is stored at a specific index, allowing efficient access and retrieval. For example, an integer array can store values such as 10, 20, 30, 40, with each value accessible using its index.

36. Which operation removes and returns the top item from a stack?

(a)Enqueue
(b)Dequeue
(c)Pop
Correct
(d)Traverse

Explanation: The pop operation removes and returns the item at the top of a stack. Push inserts a new item at the top.

37. What is a common advantage of a circular queue over a simple array queue that does not reuse freed slots?

(a)It automatically sorts elements
(b)It can reuse positions freed by dequeues
Correct
(c)It always has O(1) search
(d)It eliminates capacity limits

Explanation: A circular queue wraps its front and rear indices around the array, allowing previously freed positions to be reused. Its capacity remains bounded unless it is designed to resize.

38. Which algorithm can detect a cycle in a linked list using O(1) extra space?

(a)Floyd's tortoise-and-hare algorithm
Correct
(b)Merge sort
(c)Binary search
(d)Kruskal's algorithm

Explanation: Floyd's cycle-detection algorithm advances one pointer by one node and another by two nodes. If the list contains a cycle, the pointers eventually meet, using O(1) extra space.

39. What is the average-case time complexity of searching for a key in a balanced binary search tree?

(a)O(1)
(b)O(log n)
Correct
(c)O(n²)
(d)O(2ⁿ)

Explanation: A balanced binary search tree has height O(log n). Search follows a single root-to-leaf path, so its time is O(log n). In an unbalanced tree, worst-case search can be O(n).

40. Which algorithm is suitable for finding the shortest paths between every pair of vertices in a weighted graph?

(a)Floyd–Warshall algorithm
Correct
(b)Insertion sort
(c)Binary search
(d)KMP string matching

Explanation: Floyd–Warshall computes shortest paths between all pairs of vertices using dynamic programming. It runs in O(V³) time and supports negative edge weights, but not negative cycles.

41. Which algorithm is commonly used to find a longest common subsequence of two sequences efficiently?

(a)Dynamic programming
Correct
(b)Binary heap construction
(c)Linear probing
(d)Selection sort

Explanation: Longest common subsequence is commonly solved with dynamic programming by combining solutions for prefixes of the two sequences. The standard algorithm takes O(mn) time for lengths m and n.

42. What is the purpose of a topological ordering of a directed acyclic graph (DAG)?

(a)To list vertices so every directed edge goes from earlier to later
Correct
(b)To sort edges by weight only
(c)To find a cycle in every graph
(d)To make every vertex have degree two

Explanation: A topological ordering places each vertex before all vertices it points to. Such an ordering exists only for a directed acyclic graph and is useful for scheduling dependency-constrained tasks.

43. Which algorithm is designed to find occurrences of a pattern within a text using prefix-function information?

(a)Knuth–Morris–Pratt (KMP)
Correct
(b)Kruskal
(c)Dijkstra
(d)Heap sort

Explanation: KMP preprocesses the pattern to compute prefix information, allowing the search to avoid rechecking text characters unnecessarily. Its time complexity is O(n + m) for text length n and pattern length m.

44. Which data structure follows the Last In, First Out (LIFO) principle?

(a)Queue
(b)Stack
Correct
(c)Linked list
(d)Tree

Explanation: A stack follows LIFO: the most recently inserted item is the first one removed. Push adds an item to the top, and pop removes the top item.

45. Which traversal visits the root before its left and right subtrees?

(a)Inorder
(b)Preorder
Correct
(c)Postorder
(d)Reverse level order

Explanation: Preorder traversal processes the root first, then the left subtree, then the right subtree. It is useful for tasks such as serializing a tree.

46. Which traversal visits the root after its left and right subtrees?

(a)Preorder
(b)Inorder
(c)Postorder
Correct
(d)Level order

Explanation: Postorder traversal processes the left subtree, then the right subtree, and finally the root. It is useful when children should be processed before their parent, such as deleting a tree.

47. What is the worst-case time complexity of searching for a value in an unsorted singly linked list?

(a)O(1)
(b)O(log n)
(c)O(n)
Correct
(d)O(n log n)

Explanation: Because a singly linked list has no direct indexing and the list is unsorted, a search may need to inspect every node. The worst-case time complexity is O(n).

48. Which statement about a stable sorting algorithm is correct?

(a)It never compares elements
(b)It preserves the relative order of equal-key elements
Correct
(c)It always runs in O(n) time
(d)It uses no additional memory

Explanation: A stable sort keeps equal-key records in the same relative order as in the input. Stability does not by itself guarantee a particular running time or memory usage.

49. What is the best-case time complexity of bubble sort with an early-exit check on already sorted input?

(a)O(1)
(b)O(log n)
(c)O(n)
Correct
(d)O(n²)

Explanation: With an early-exit flag, bubble sort can detect that no swaps occurred during the first pass and stop. That pass still scans the array, so the best-case time is O(n).

50. Which of these is a linear data structure?

(a)Tree
(b)Graph
(c)Queue
Correct
(d)Heap

Explanation: A queue organizes elements in a linear sequence with insertion at the rear and removal from the front. Trees, graphs, and heaps represent non-linear relationships.

51. What does an algorithm's time complexity describe?

(a)How its running work grows as input size grows
Correct
(b)The exact time on every computer
(c)The number of developers needed
(d)The amount of disk space in every deployment

Explanation: Time complexity models how the amount of computational work grows with input size, often using asymptotic notation. Actual elapsed time also depends on hardware, implementation, and other factors.

52. What is the main purpose of a union-find (disjoint-set) data structure?

(a)Maintain disjoint sets and efficiently test/merge set membership
Correct
(b)Sort all values automatically
(c)Store only hierarchical text
(d)Perform random access in a linked list

Explanation: Union-find maintains a partition of elements into disjoint sets. Find identifies an element's set, and union merges sets; path compression and union by rank/size make operations nearly constant amortized time.

53. Which data structure follows the First In, First Out (FIFO) principle?

(a)Stack
(b)Graph
(c)Queue
Correct
(d)Heap

Explanation: A queue follows FIFO: the earliest inserted item is removed first. Enqueue adds an item at the rear, while dequeue removes one from the front.

54. What is the time complexity of accessing an array element by index?

(a)O(1)
Correct
(b)O(log n)
(c)O(n)
(d)O(n log n)

Explanation: Arrays support direct index-based access, so accessing a known position takes constant time, O(1), under the usual array model.

55. What is the worst-case time complexity of linear search?

(a)O(1)
(b)O(log n)
(c)O(n)
Correct
(d)O(n log n)

Explanation: In the worst case, linear search checks every element, such as when the target is absent or is the final element. Its running time grows linearly with n.

56. What is the worst-case time complexity of binary search on a sorted array?

(a)O(n)
(b)O(log n)
Correct
(c)O(n log n)
(d)O(1)

Explanation: Binary search compares the target with the middle element and discards about half of the remaining search range each step, giving O(log n) worst-case time.

57. Which condition is required for binary search on a conventional array?

(a)The array must be sorted
Correct
(b)The array must contain unique values
(c)The array must have an even length
(d)The array must contain integers only

Explanation: Binary search relies on the order of elements to decide which half can be discarded. Duplicate values and non-integer values are allowed if ordering and comparisons are well-defined.

58. Which data structure is commonly used to manage function calls and recursion?

(a)Queue
(b)Stack
Correct
(c)Graph
(d)Hash table

Explanation: Function calls are managed using a call stack. Each call creates a stack frame containing information such as local variables and the return address; the frame is removed when the call returns.

59. Which data structure is most suitable for representing a hierarchical structure such as a family tree?

(a)Queue
(b)Stack
(c)Tree
Correct
(d)Hash table

Explanation: A tree represents hierarchical relationships through nodes connected by parent-child links. It has a root and can contain subtrees.

60. Which data structure is typically used to implement breadth-first search (BFS)?

(a)Stack
(b)Queue
Correct
(c)Heap only
(d)Call stack

Explanation: Breadth-first search uses a queue to process vertices in the order they are discovered, exploring a graph level by level.

61. Which data structure is typically used to implement depth-first search (DFS) iteratively?

(a)Stack
Correct
(b)Queue
(c)Sorted array
(d)Circular buffer only

Explanation: Iterative depth-first search uses a stack to visit a recently discovered vertex before backtracking. Recursive DFS uses the program's call stack.

62. In a singly linked list, what does each node usually contain?

(a)Only an array index
(b)Data and a reference to the next node
Correct
(c)Two child pointers only
(d)A priority value only

Explanation: A singly linked-list node stores its data and a link or reference to the next node. The last node's next reference is usually null.

63. What is the typical time complexity of inserting a node at the head of a linked list?

(a)O(1)
Correct
(b)O(log n)
(c)O(n)
(d)O(n log n)

Explanation: Inserting at the head requires creating a node, pointing it to the former head, and updating the head reference. These operations take constant time, O(1).

64. What is the average-case lookup time for a well-designed hash table?

(a)O(n)
(b)O(log n)
(c)O(1)
Correct
(d)O(n log n)

Explanation: A hash table can locate a bucket from a key's hash and typically performs lookup in expected O(1) time with a suitable hash function and controlled load factor. Worst-case lookup can be O(n).

65. What is a collision in a hash table?

(a)Two keys map to the same table location
Correct
(b)A key is deleted twice
(c)The table is sorted
(d)A linked list becomes circular

Explanation: A collision occurs when different keys map to the same bucket or slot. Collision handling commonly uses separate chaining or open addressing.

66. Which traversal of a binary search tree visits keys in non-decreasing order?

(a)Preorder
(b)Postorder
(c)Inorder
Correct
(d)Level order

Explanation: Inorder traversal visits the left subtree, then the node, then the right subtree. For a binary search tree with the usual ordering property, this visits keys in sorted non-decreasing order.

67. In a binary tree, what is the maximum number of children a node can have?

(a)One
(b)Two
Correct
(c)Three
(d)Unlimited

Explanation: A binary tree permits at most two children per node, conventionally called the left child and the right child.

68. Which algorithm finds a minimum spanning tree in a connected, weighted, undirected graph?

(a)Binary search
(b)Kruskal's algorithm
Correct
(c)KMP algorithm
(d)Floyd's cycle detection

Explanation: Kruskal's algorithm sorts edges by weight and adds an edge when it connects different components, avoiding cycles. For a connected weighted undirected graph, it produces a minimum spanning tree.

69. Which algorithm is commonly used to find shortest paths from one source when all edge weights are non-negative?

(a)Dijkstra's algorithm
Correct
(b)Merge sort
(c)Kruskal's algorithm
(d)Depth-first traversal alone

Explanation: Dijkstra's algorithm repeatedly finalizes the currently closest unsettled vertex and relaxes its outgoing edges. Its standard correctness guarantee requires non-negative edge weights.

70. Which sorting algorithm has O(n log n) worst-case time complexity and is stable in its standard implementation?

(a)Bubble sort
(b)Merge sort
Correct
(c)Selection sort
(d)Basic quicksort

Explanation: Merge sort divides the input, recursively sorts each half, and merges the sorted halves. Its worst-case time is O(n log n), and the standard merge procedure can preserve the relative order of equal keys.

71. What is the worst-case time complexity of quicksort when consistently poor pivots are chosen?

(a)O(log n)
(b)O(n)
(c)O(n log n)
(d)O(n²)
Correct

Explanation: If each partition separates only one element from the rest, the recursion becomes highly unbalanced. The total work is then proportional to n + (n−1) + ... + 1, which is O(n²).

72. What is the worst-case time complexity of insertion sort?

(a)O(1)
(b)O(log n)
(c)O(n)
(d)O(n²)
Correct

Explanation: In reverse-sorted input, each new element may need to move past all previously processed elements. The total number of shifts is quadratic, giving O(n²) worst-case time.

73. Which sorting algorithm repeatedly selects the smallest remaining element and places it in the next position?

(a)Selection sort
Correct
(b)Merge sort
(c)Heap sort
(d)Counting sort

Explanation: Selection sort finds the minimum element in the unsorted portion and swaps it into the next sorted position. It performs O(n²) comparisons in its usual implementation.

74. Which sorting algorithm is generally efficient for nearly sorted small arrays?

(a)Insertion sort
Correct
(b)Heap sort
(c)Radix sort only
(d)Bogosort

Explanation: Insertion sort performs well on small or nearly sorted arrays because each element moves only a short distance. Its best-case running time is O(n), while its worst case is O(n²).

75. What is the time complexity of building a binary heap from an unsorted array using bottom-up heap construction?

(a)O(n)
Correct
(b)O(log n)
(c)O(n log n)
(d)O(n²)

Explanation: Bottom-up heap construction is O(n), not O(n log n), because most nodes are near the leaves and require little or no sift-down work.

76. In a max-heap, where is the maximum element stored?

(a)At the last array index
(b)At the root
Correct
(c)At the leftmost leaf
(d)At an arbitrary leaf

Explanation: A max-heap maintains the property that every parent is greater than or equal to its children. Therefore, the maximum element is at the root.

77. What is the auxiliary space complexity of a typical recursive merge sort on an array?

(a)O(1)
(b)O(log n) total
(c)O(n)
Correct
(d)O(n²)

Explanation: Array-based merge sort typically uses O(n) auxiliary storage for merging. Its recursion stack is O(log n), but the additional array storage dominates, so total auxiliary space is O(n).

78. What is the base case for the usual recursive factorial definition?

(a)0! = 1
Correct
(b)0! = 0
(c)1! = 0
(d)n! = n × n!

Explanation: The standard factorial definition uses 0! = 1 as its base case and n! = n × (n−1)! for positive integers n. The base case stops the recursion.

79. What is the value of the Fibonacci sequence's next term after 0, 1, 1, 2, 3, 5, 8?

(a)10
(b)11
(c)13
Correct
(d)16

Explanation: Each Fibonacci term is the sum of the two preceding terms. The next term after 5 and 8 is 5 + 8 = 13.

80. Which algorithm design technique solves a problem by dividing it into smaller subproblems, solving them, and combining their results?

(a)Divide and conquer
Correct
(b)Linear probing
(c)Sequential access
(d)Backtracking only

Explanation: Divide and conquer breaks a problem into smaller subproblems, solves them recursively or independently, and combines their results. Merge sort and binary search are classic examples.

81. What does Big-O notation commonly describe in algorithm analysis?

(a)An asymptotic upper bound on growth
Correct
(b)The exact execution time in seconds
(c)The programming language used
(d)The number of source-code lines

Explanation: Big-O notation describes an asymptotic upper bound on how an algorithm's resource use grows with input size. It does not directly specify wall-clock time in seconds.

82. What does space complexity measure?

(a)Only CPU clock speed
(b)Memory usage as a function of input size
Correct
(c)Number of users of a program
(d)Network bandwidth only

Explanation: Space complexity describes how memory requirements grow with input size. Analyses may distinguish total space from auxiliary space used in addition to the input.

83. Which notation gives an asymptotic lower bound?

(a)Big-O
(b)Big-Omega
Correct
(c)Big-Theta
(d)Little-o only

Explanation: Big-Omega notation expresses an asymptotic lower bound. Big-O gives an upper bound, while Big-Theta gives a tight asymptotic bound when both upper and lower bounds hold.

84. Which graph representation is often space-efficient for a sparse graph?

(a)Adjacency matrix
(b)Adjacency list
Correct
(c)A full n × n table always
(d)Sorted array of all possible edges

Explanation: An adjacency list stores each vertex and its existing neighbors, using O(V + E) space. An adjacency matrix uses O(V²) space, which can be wasteful when the graph has relatively few edges.

85. What is the maximum number of edges in a simple undirected graph with n vertices?

(a)n
(b)n²
(c)n(n−1)/2
Correct
(d)2n

Explanation: In a simple undirected graph, each pair of distinct vertices can share at most one edge and self-loops are not allowed. There are n choose 2 possible pairs, or n(n−1)/2 edges.

86. Which data structure is commonly used to implement a priority queue efficiently?

(a)Binary heap
Correct
(b)Unsorted text file
(c)Stack only
(d)Simple linked list in every case

Explanation: A binary heap supports efficient priority-queue operations: peek at the highest-priority item in O(1), and insert or remove the top item in O(log n). Other implementations may be appropriate for different workloads.

Categories

Communication Skills MCQs
7
Data Structure and Alogrithm MCQs
1