Free Practice Quiz Question List

05 — Data Structures Online Quiz Questions

Use this free practice quiz with 20 questions to review 05 — Data Structures, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

A program stores monthly temperatures and frequently retrieves the temperature for a specified day by its numeric position. Which data structure is the most suitable choice?

  1. A

    A linked list, because every insertion is always O(1)

  2. B

    A dynamic array, because indexed access is typically O(1)

  3. C

    A stack, because it supports LIFO behavior

  4. D

    A graph, because it represents relationships

02
Choose one
1 point

A program pushes A, then B, then C onto a structure and removes one item. Which structure guarantees that C is removed first?

  1. A

    Stack

  2. B

    Queue

  3. C

    Hash table

  4. D

    Adjacency matrix

03
Choose one
1 point

A service repeatedly retrieves customer records using unique customer IDs and does not need the records in sorted order. Which structure best matches this access pattern?

  1. A

    A tree, because every lookup is guaranteed to be O(log n)

  2. B

    A queue, because records should be processed in arrival order

  3. C

    A hash table, because average-case lookup by key is typically O(1)

  4. D

    A linked list, because it grows without resizing

04
Choose all
1 point

Which statements correctly describe an adjacency matrix? Select all that apply.

  1. A

    It uses O(V²) space.

  2. B

    It provides O(1) edge lookup.

  3. C

    It stores only the neighbors of each vertex, using O(V + E) space.

  4. D

    It can be useful for dense graphs.

05
Choose all
1 point

Which statements correctly describe breadth-first search in an unweighted graph? Select all that apply.

  1. A

    It follows one path as far as possible before backtracking.

  2. B

    It explores vertices in layers.

  3. C

    It uses a queue.

  4. D

    It requires weighted edges to find shortest paths.

06
True or false
1 point

True or false: Accessing the item at a specified position in a singly linked list is typically O(n).

  1. A

    True

  2. B

    False

07
True or false
1 point

True or false: A priority queue always removes the oldest item first, regardless of its priority.

  1. A

    True

  2. B

    False

08
Written response
1 point

How many links does each node in a doubly linked list store for navigation? Enter the whole-number count.

09
Written response
1 point

What uppercase acronym names the removal rule followed by a stack? Enter the acronym only.

10
Choose one
1 point

A dictionary must support ordered insertion and lookup while keeping these operations logarithmic as the number of keys grows. Which structure is the best fit?

  1. A

    A balanced binary search tree

  2. B

    A singly linked list

  3. C

    An unsorted array

  4. D

    A stack

11
True or false
1 point

True or false: A tree is a connected structure with no cycles.

  1. A

    True

  2. B

    False

12
Choose one
1 point

Which data structure is the most direct choice when a program frequently retrieves items by their numeric position?

  1. A

    A linked list

  2. B

    An array

  3. C

    A hash table

  4. D

    A graph

13
Choose one
1 point

A program must remove the most recently added item before any earlier item. Which data structure directly provides this behavior?

  1. A

    Queue

  2. B

    Tree

  3. C

    Stack

  4. D

    Hash table

14
Choose one
1 point

A singly linked list already provides a reference to the node after which a new node should be inserted. Which statement best describes the insertion operation itself?

  1. A

    The link changes can be O(1).

  2. B

    The insertion is always O(log n).

  3. C

    The insertion is always O(n²).

  4. D

    The insertion requires shifting every later node.

15
Choose one
1 point

A hash table must store multiple key–value pairs that map to the same bucket. Which collision-handling method stores those entries in a collection associated with that bucket?

  1. A

    Discarding the later key

  2. B

    Chaining

  3. C

    Sorting all keys after every insertion

  4. D

    Replacing the hash function with an index lookup

16
Written response
1 point

Which graph traversal explores vertices in layers by using a queue?

17
Written response
1 point

A graph has 12 vertices. How many entries does its V × V adjacency matrix contain?

18
Fill in the blank
1 point

A dynamic array may occasionally allocate a larger block and copy its elements. Even though an individual resize can be expensive, the cost of appending over a long sequence is typically O(1) .

19
Fill in the blank
1 point

For a sparse graph with V vertices and E edges, an adjacency list requires space.

20
Open ended
1 point

Explain what asymptotic notation communicates about an operation's efficiency. In your answer, compare O(1), O(log n), and O(n), and explain why an O(log n) operation generally scales better than an O(n) operation for large inputs.