Complexity Analysis MCQsBy: Prof. Dr. Fazal Rehman | Last updated: May 14, 2025 37 Score: 0 Attempted: 0/37 Subscribe 1. : What is the time complexity of accessing an element in an array? (A) O(n) (B) O(log n) (C) O(1) (D) O(n²) 2. : Which of the following represents the best case time complexity for bubble sort? (A) O(n) (B) O(n log n) (C) O(n²) (D) O(1) 3. : What is the space complexity of a recursive algorithm that uses stack space? (A) O(1) (B) O(n) (C) O(n²) (D) O(log n) 4. : Which of the following sorting algorithms has the worst case time complexity of O(n²)? (A) Quick Sort (B) Merge Sort (C) Bubble Sort (D) Heap Sort 5. : What is the time complexity of searching for an element in a balanced binary search tree? (A) O(n) (B) O(log n) (C) O(n log n) (D) O(1) 6. : Which of the following algorithms has a time complexity of O(n log n) in the average case? (A) Selection Sort (B) Insertion Sort (C) Merge Sort (D) Bubble Sort 7. : What is the time complexity of inserting an element into a binary heap? (A) O(n) (B) O(log n) (C) O(1) (D) O(n log n) 8. : In the context of complexity analysis, what does “big O” notation describe? (A) Worst case scenario (B) Average case scenario (C) Best case scenario (D) None of the above 9. : What is the time complexity of a linear search algorithm? (A) O(1) (B) O(log n) (C) O(n) (D) O(n²) 10. : Which of the following is true about the time complexity of merge sort? (A) It is O(n) in all cases (B) It is O(n²) in the worst case (C) It is O(n log n) in all cases (D) It is O(log n) in the worst case 11. : What is the average case time complexity of quicksort? (A) O(n²) (B) O(n log n) (C) O(n) (D) O(log n) 12. : What is the space complexity of an iterative algorithm? (A) O(1) (B) O(n) (C) O(n²) (D) O(log n) 13. : In which case is the time complexity of selection sort O(n²)? (A) Best case (B) Average case (C) Worst case (D) All cases 14. : What is the time complexity of an algorithm that performs n operations in each of n iterations? (A) O(n) (B) O(n log n) (C) O(n²) (D) O(n³) 15. : Which of the following represents the worst-case time complexity for a binary search? (A) O(1) (B) O(log n) (C) O(n) (D) O(n log n) 16. : What is the time complexity of inserting an element at the beginning of a linked list? (A) O(1) (B) O(n) (C) O(log n) (D) O(n log n) 17. : Which of the following is a characteristic of exponential time complexity? (A) Grows linearly (B) Grows quadratically (C) Grows rapidly with input size (D) Grows logarithmically 18. : What is the space complexity of depth-first search (DFS) in a graph? (A) O(1) (B) O(n) (C) O(n²) (D) O(log n) 19. : What is the time complexity of traversing a linked list? (A) O(1) (B) O(n) (C) O(log n) (D) O(n²) 20. : In which scenario does a linear search perform better than a binary search? (A) When the list is sorted (B) When the list is unsorted (C) When the list is very small (D) Both B and C 21. : What is the time complexity of deleting the minimum element from a binary heap? (A) O(1) (B) O(n) (C) O(log n) (D) O(n log n) 22. : Which of the following is an example of a polynomial time complexity? (A) O(n³) (B) O(2ⁿ) (C) O(log n) (D) O(n!) 23. : What is the average case time complexity for inserting an element in a hash table? (A) O(1) (B) O(n) (C) O(log n) (D) O(n log n) 24. : Which sorting algorithm is generally not stable? (A) Merge Sort (B) Bubble Sort (C) Quick Sort (D) Insertion Sort 25. : What is the time complexity of counting the number of elements in a linked list? (A) O(1) (B) O(n) (C) O(log n) (D) O(n²) 26. : Which of the following time complexities represents a linearithmic algorithm? (A) O(n) (B) O(n log n) (C) O(log n) (D) O(n²) 27. : What is the space complexity of a binary search algorithm? (A) O(1) (B) O(n) (C) O(log n) (D) O(n²) 28. : Which algorithm has the best average-case time complexity? (A) Bubble Sort (B) Insertion Sort (C) Merge Sort (D) Quick Sort 29. : What is the time complexity of the worst-case scenario for binary search? (A) O(n) (B) O(log n) (C) O(n log n) (D) O(n²) 30. : Which of the following statements about time complexity is true? (A) It only considers the best case (B) It can be expressed using big O notation (C) It is always linear (D) It does not consider the size of input 31. : What is the average case time complexity of heap sort? (A) O(n) (B) O(n log n) (C) O(n²) (D) O(log n) 32. : What is the time complexity of merging two sorted arrays of size n? (A) O(1) (B) O(n) (C) O(log n) (D) O(n²) 33. : Which of the following algorithms has the best worst-case time complexity? (A) Quick Sort (B) Merge Sort (C) Bubble Sort (D) Insertion Sort 34. : What is the time complexity for the Fibonacci sequence using dynamic programming? (A) O(2ⁿ) (B) O(n) (C) O(n²) (D) O(log n) 35. : Which of the following is a characteristic of logarithmic time complexity? (A) Reduces the size of the problem with each iteration (B) Grows linearly with input size (C) Is faster than polynomial time complexity (D) None of the above 36. : What is the time complexity of a binary search tree in the worst case? (A) O(log n) (B) O(n) (C) O(n log n) (D) O(n²) 37. : Which algorithm is considered optimal for sorting large datasets? (A) Quick Sort (B) Bubble Sort (C) Insertion Sort (D) Selection Sort Data Structures MCQs Basic Concepts Introduction to Data Structures Abstract Data Types (ADT) MCQs Complexity Analysis MCQs Time complexity MCQs Space complexity MCQs Big O, Big Ω, Big Θ notations MCQs Linear Data Structures MCQs Arrays MCQs One-dimensional arrays MCQs Multi-dimensional arrays MCQs Operations: traversal, insertion, deletion MCQs Linked Lists MCQs Singly linked list MCQs Doubly linked list MCQs Circular linked list MCQs Stacks MCQs Stack operations (push, pop, peek) MCQs Applications of stacks (expression evaluation, recursion) MCQs Queues MCQs Queue operations (enqueue, dequeue, front, rear) MCQs Types: Simple queue, circular queue, priority queue, deque MCQs Non-Linear Data Structures MCQs Trees MCQs Binary trees MCQs Binary Search Trees (BST) MCQs AVL Trees MCQs B-trees and B+ trees MCQs Tree traversal methods (in-order, pre-order, post-order) MCQs Heaps MCQs Min-heap MCQs Max-heap MCQs Heap operations (insertion, deletion, heapify) MCQs Applications of heaps (priority queues, heap sort) MCQs Graphs MCQs Graph representation (adjacency matrix, adjacency list) MCQs Graph traversal algorithms (DFS, BFS) MCQs Shortest path algorithms (Dijkstra’s, Bellman-Ford) MCQs Minimum Spanning Tree (Kruskal’s, Prim’s) MCQs Hashing MCQs MCQs Hash Tables Hash functions MCQs Collision resolution techniques (chaining, open addressing) MCQs Applications of hashing MCQs Sorting and Searching Algorithms MCQs Sorting Algorithms MCQs Bubble sort MCQs Selection sort MCQs Insertion sort MCQs Merge sort MCQs Quick sort MCQs Heap sort MCQs Searching Algorithms MCQs Linear search MCQs Binary search MCQs Interpolation search MCQs Miscellaneous Memory Management in data structures MCQs Dynamic memory allocation MCQs Garbage collection MCQs String Manipulation Algorithms MCQs Pattern matching (KMP, Rabin-Karp) MCQs String hashing MCQs Data Structures MCQs 1 Data Structures MCQs 2 Data Structures MCQs 3 Data Structures MCQs 4 Data Structures MCQs 5 Stacks Solved MCQs Queues MCQs pointer mcqs Array MCQs Related Posts:Role of lexical analysis, syntax analysis, semantic analysis, optimization, and code generation(MCQs)Space complexity classes (PSPACE, L, NL) MCQsSpace complexity MCQsTime complexity MCQsTime complexity classes (P, NP, NP-complete, NP-hard) MCQsWhite Box - Cyclomatic complexity