Data Structure Quiz

Questions: 16 · 10 minutes
1. What is a collision in a hash table?
Two different keys are assigned to the same bucket or index
A key is inserted more than once with the same value
The table's keys are stored in sorted order
A lookup examines every bucket before returning
2. An application needs fast average-case membership checks for unique user IDs and does not need to preserve their order. Which structure is the most direct fit?
Dynamic array
User ID queue
Hash-based set
Binary min-heap
3. Which ordering relationship defines a min-heap?
Every left child is smaller than its right sibling
Nodes are ordered by their insertion time
All keys in the left subtree are smaller than the root key
Every parent has a key no greater than the keys of its children
4. An autocomplete system must efficiently retrieve words that begin with a supplied character sequence. Which data structure is especially suited to this task?
Character stack
Word disjoint-set structure
Prefix trie
Suggestion min-heap
5. A graph has millions of possible vertices but relatively few edges. Why is an adjacency list usually preferred to an adjacency matrix?
It automatically keeps every vertex sorted
It guarantees constant-time lookup for every possible edge
It removes the need to store vertex identifiers
Its storage is proportional to the vertices and existing edges rather than every possible pair
6. Which stack operation removes and returns the item added most recently?
Pop
Dequeue
Peek
Enqueue
7. A printer must process jobs in the same order they arrive. Which data structure most directly supports this behavior?
Stack
Set
Queue
Binary search tree
8. A scheduler frequently adds tasks with numeric priorities and repeatedly removes the task with the smallest priority value. Which structure is typically appropriate?
Min-heap
FIFO queue
Hash set
Singly linked list
9. A dynamic array occasionally allocates a larger block and copies its elements, but most appends place an item directly at the end. What is the typical amortized time per append?
Logarithmic amortized time: O(log n)
Constant amortized time: O(1)
Linear amortized time: O(n)
Quadratic amortized time: O(n squared)
10. You need to detect whether a singly linked list contains a cycle while using O(1) extra space. Which technique fits this requirement?
Move one pointer by one step and another by two steps
Copy every node into a second linked list
Sort the nodes by their stored values
Run binary search over the node positions
11. For a valid binary search tree containing distinct keys, which traversal visits the keys in ascending order?
Pre-order traversal
In-order traversal
Post-order traversal
Level-order traversal
12. You want to find a path with the fewest edges from a starting vertex in an unweighted graph. Which traversal and supporting structure should you use?
Depth-first search with a stack
Depth-first search with a min-heap
In-order traversal with a stack
Breadth-first search with a queue
13. A network application repeatedly merges groups of connected devices and asks whether two devices currently belong to the same group. Which structure is designed for these operations?
Prefix trie
Circular task queue
Disjoint-set union
Ordered binary search tree
14. You already have a reference to a node in a singly linked list and want to insert a new node immediately after it. What is the usual time complexity of updating the links?
Linearithmic time, O(n log n)
Constant time, O(1)
Logarithmic time, O(log n)
Linear time, O(n)
15. You need to repeatedly search a large array by discarding half of the remaining elements at each step. What condition must the array satisfy?
It must contain no duplicate values
It must have a fixed capacity
It must store elements in insertion order
It must be sorted according to the search order
16. Which data structure is normally used by a program to track active function calls during recursion?
Call queue
Call stack
Function hash table
Call graph
Popular tests
Narcissistic Personality Inventory (NPI)
This self-report measure is used to assess narcissism as a personality trai…
Start Test
Yale-Brown Obsessive Compulsive Scale (Y-BOCS)
This measure is used to rapidly quantify the current severity of obsessive…
Start Test
CRAFFT Screening Test (CRAFFT 2.1)
This brief screening measure is designed to identify potential alcohol and…
Start Test
Patient Health Questionnaire-9 (PHQ-9)
This measure is commonly used to quickly screen for the presence and severi…
Start Test
Maslach Burnout Inventory (MBI)
This self-report measure is used to assess occupational burnout symptoms in…
Start Test
Adolescent Anxiety Questionnaire
This measure is designed to support a brief appraisal of anxiety symptoms a…
Start Test
Emotional Creativity Inventory (ECI)
This self-report measure assesses individual differences in the originality…
Start Test
Horne–Ostberg Morningness–Eveningness Questionnaire (MEQ)
Circadian preferences influence typical patterns of alertness and sleep tim…
Start Test
Ambivalent Sexism Inventory (ASI)
This measure is designed to assess attitudes toward women, including both o…
Start Test
Internalized Misogyny Scale (IMS)
This measure is designed to assess internalized negative beliefs and stereo…
Start Test
Perceived Stress Scale (PSS-10)
This self-report measure assesses the degree to which individuals appraise…
Start Test
Impulsive Behavior Scale (SUPPS-P)
Impulsivity is a multidimensional construct that is often assessed with bri…
Start Test
Clinical Institute Withdrawal Assessment for Alcohol, Revised (CIWA-Ar)
This rating scale is used to rapidly assess the severity of alcohol withdra…
Start Test
Positive and Negative Affect Schedule (PANAS)
This measure provides a brief self-report assessment of current or typical…
Start Test
Light Triad Scale (LTS)
This self-report measure assesses prosocial personality tendencies and orie…
Start Test
Suicidal Ideation Scale
In clinical settings, the Suicidal Ideation Scale is used to structure an i…
Start Test
Body Dysmorphic Disorder Scale (BDD-D)
This brief self-report measure is designed to screen for and quantify distr…
Start Test
Beck Anxiety Inventory (BAI)
This measure is a brief self-report inventory used to screen for anxiety sy…
Start Test
Differential Test of Perfectionism
This instrument is used to screen for perfectionism-related attitudes and t…
Start Test
Locus of Control Scale
This measure assesses generalized expectancies regarding the degree to whic…
Start Test
New Apathy Scale
This brief self-report measure is used to screen for apathy-related symptom…
Start Test
Perth Alexithymia Questionnaire (PAQ)
This measure assesses individual differences in alexithymia, including diff…
Start Test
Social Intelligence Scale
This brief self-report measure is designed to support rapid screening of in…
Start Test
Fear Test
This measure is designed to evaluate individual differences in fear-related…
Start Test
Neuroticism Level Scale
The measure is intended for brief screening of an individual’s propensity t…
Start Test
Aggressiveness Indicators Screening Questionnaire
This screening tool is designed to quickly identify behavioral indicators a…
Start Test