AllInfoHub Logo

AllInfoHub – MCQ Practice

Data Structures and Algorithms – Multiple Choice Questions (MCQs)

  1. 1. What is a linear data structure?

    • A. Tree
    • B. Graph
    • C. Array
    • D. Linked List
  2. 2. Which data structure follows the Last-In, First-Out (LIFO) principle?

    • A. Queue
    • B. Stack
    • C. Tree
    • D. Graph
  3. 3. Which data structure follows the First-In, First-Out (FIFO) principle?

    • A. Stack
    • B. Queue
    • C. Tree
    • D. Graph
  4. 4. What is the time complexity of accessing an element in an array by its index?

    • A. O(1)
    • B. O(n)
    • C. O(log n)
    • D. O(n log n)
  5. 5. What is the time complexity of searching for an element in an unsorted array?

    • A. O(1)
    • B. O(n)
    • C. O(log n)
    • D. O(n log n)
  6. 6. What is the time complexity of searching for an element in a sorted array using binary search?

    • A. O(1)
    • B. O(n)
    • C. O(log n)
    • D. O(n log n)
  7. 7. What is a linked list?

    • A. A contiguous block of memory
    • B. A collection of nodes where each node contains data and a pointer to the next node
    • C. A hierarchical data structure
    • D. A collection of key-value pairs
  8. 8. What is the time complexity of inserting an element at the beginning of a singly linked list?

    • A. O(1)
    • B. O(n)
    • C. O(log n)
    • D. O(n log n)
  9. 9. What is the time complexity of inserting an element at the beginning of a doubly linked list?

    • A. O(1)
    • B. O(n)
    • C. O(log n)
    • D. O(n log n)
  10. 10. What is a stack?

    • A. A linear data structure that allows insertion and deletion at both ends
    • B. A linear data structure that allows insertion and deletion at one end only
    • C. A hierarchical data structure
    • D. A non-linear data structure
  11. 11. The operation of adding an element to a stack is called:

    • A. Pop
    • B. Push
    • C. Peek
    • D. Enqueue
  12. 12. The operation of removing an element from a stack is called:

    • A. Push
    • B. Pop
    • C. Peek
    • D. Dequeue