wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structures Quiz

Total questions: 74

Worksheet time: 37mins

Name
Class
Date
1.

What is a data structure?

a)

A type of algorithm

b)

A method for organizing and storing data

c)

A programming language

d)

A hardware component

2.

Which of the following is a linear data structure?

a)

Tree

b)

Array

c)

Hash Table

d)

Graph

3.

What is the main advantage of a linked list over an array?

a)

Dynamic size

b)

Easier to implement

c)

Faster access time

d)

Less memory usage

4.

What does ADT stand for?

a)

Advanced Data Technique

b)

Abstract Data Type

c)

Applied Data Theory

d)

Algorithm Data Type

5.

Which operation is NOT typically associated with a stack?

a)

Push

b)

Pop

c)

Enqueue

d)

Peek

6.

What is the time complexity of linear search?

a)

O(n log n)

b)

O(log n)

c)

O(n)

d)

O(1)

7.

In which data structure is the last element added the first one to be removed?

a)

Array

b)

Linked List

c)

Stack

d)

Queue

8.

What is the primary use of a hash table?

a)

To create a binary tree

b)

To store data in a sorted manner

c)

To allow fast data retrieval

d)

To implement a stack

9.

Which of the following is a type of sorting algorithm?

a)

Breadth First Search

b)

Depth First Search

c)

Binary Search

d)

Bubble Sort

10.

What is the worst-case time complexity of quicksort?

a)

O(n)

b)

O(n^2)

c)

O(log n)

d)

O(n log n)

11.

Which data structure uses a FIFO (First In First Out) method?

a)

Linked List

b)

Stack

c)

Queue

d)

Array

12.

What is the primary purpose of a priority queue?

a)

To implement a stack

b)

To allow elements to be processed based on priority

c)

To create a binary tree

d)

To store elements in a sorted order

13.

Which of the following is NOT a type of linked list?

a)

Circular Linked List

b)

Triangular Linked List

c)

Doubly Linked List

d)

Singly Linked List

14.

What is the main disadvantage of using an array?

a)

Fixed size

b)

Dynamic size

c)

Easier to implement

d)

Faster access time

15.

Which traversal method is used in depth-first search?

a)

All of the above

b)

Post-order

c)

In-order

d)

Pre-order

16.

What is the time complexity of bubble sort in the worst case?

a)

O(n log n)

b)

O(n^2)

c)

O(log n)

d)

O(n)

17.

Which data structure is best for implementing recursion?

a)

Stack

b)

Queue

c)

Linked List

d)

Array

18.

What is the primary function of a binary search tree?

a)

To store data in a sorted manner

b)

To create a hash table

c)

To allow fast data retrieval

d)

To implement a stack

19.

Which of the following is a characteristic of a min-heap?

a)

The parent node is always less than its children

b)

Both b and c

c)

The parent node is always greater than its children

d)

It is a complete binary tree

20.

What is the main purpose of a graph?

a)

To create a hash table

b)

To represent relationships between objects

c)

To store data in a sorted manner

d)

To implement a stack

21.

Which of the following is NOT a graph traversal method?

a)

Depth First Search

b)

Breadth First Search

c)

Linear Search

d)

Both a and b

22.

What is the time complexity of insertion sort in the worst case?

a)

O(n log n)

b)

O(n^2)

c)

O(n)

d)

O(log n)

23.

Which of the following is a characteristic of a doubly linked list?

a)

Each node has two pointers

b)

Both b and c

c)

It is a linear data structure

d)

Each node has one pointer

24.

What is the main advantage of using a circular queue?

a)

Dynamic size

b)

Faster access time

c)

Easier to implement

d)

No wasted space

25.

Which of the following is a characteristic of a stack?

a)

Elements are added at the front

b)

Elements are removed from the back

c)

Elements are removed from the front

d)

Elements are added at the back

26.

What is the primary use of a hash function?

a)

To allow fast data retrieval

b)

To store data in a sorted manner

c)

To create a binary tree

d)

To implement a stack

27.

Which of the following is NOT a type of sorting algorithm?

a)

Selection Sort

b)

Traversal Sort

c)

Bubble Sort

d)

Insertion Sort

28.

What is the time complexity of merge sort?

a)

O(n)

b)

O(n^2)

c)

O(n log n)

d)

O(log n)

29.

Which data structure is used to implement a priority queue?

a)

Stack

b)

Linked List

c)

Array

d)

Heap

30.

What is the main disadvantage of a linked list?

a)

No direct access to elements

b)

Dynamic size

c)

Faster access time

d)

Easier to implement

31.

Which of the following is a characteristic of a binary search tree?

a)

Each node has two children

b)

The left child is always less than the parent

c)

The right child is always greater than the parent

d)

All of the above

32.

What is the primary purpose of a queue?

a)

To create a binary tree

b)

To implement a stack

c)

To allow elements to be processed in order

d)

To store elements in a sorted order

33.

Which of the following is a characteristic of a min-heap?

a)

The parent node is always greater than its children

b)

The parent node is always less than its children

c)

It is a complete binary tree

d)

Both b and c

34.

What is the time complexity of searching in a hash table?

a)

O(1)

b)

O(log n)

c)

O(n)

d)

O(n log n)

35.

Which of the following is NOT a characteristic of a tree?

a)

It can have leaf nodes

b)

It has a root node

c)

It has a linear structure

d)

It has child nodes

36.

What is the main purpose of a binary tree?

a)

To create a hash table

b)

To implement a stack

c)

To allow fast data retrieval

d)

To store data in a sorted manner

37.

Which of the following is a characteristic of a circular linked list?

a)

The last node points to the first node

b)

The last node points to NULL

c)

It is a linear data structure

d)

Both b and c

38.

What is the time complexity of depth-first search?

a)

O(n)

b)

O(n^2)

c)

O(n log n)

d)

O(log n)

39.

Which of the following is a characteristic of a queue?

a)

Elements are added at the back

b)

Elements are added at the front

c)

Elements are removed from the front

d)

Elements are removed from the back

40.

What is the primary use of a stack?

a)

To store elements in a sorted order

b)

To allow elements to be processed in order

c)

To create a binary tree

d)

To implement a last-in, first-out structure

41.

Which of the following is a characteristic of a doubly linked list?

a)

Both b and c

b)

It is a linear data structure

c)

Each node has two pointers

d)

Each node has one pointer

42.

What is the time complexity of breadth-first search?

a)

O(n)

b)

O(n log n)

c)

O(n^2)

d)

O(log n)

43.

Which of the following is NOT a type of tree?

a)

Circular Tree

b)

Binary Search Tree

c)

AVL Tree

d)

Binary Tree

44.

What is the main purpose of the Quick Sort algorithm?

a)

To merge two sorted arrays

b)

To sort an array by partitioning it

c)

To search for an element in a sorted array

d)

To find the maximum element in an array

45.

In Quick Sort, what is the role of the pivot?

a)

To divide the array into two halves

b)

To determine the final position of elements

c)

To sort the elements in ascending order

d)

To find the median of the array

46.

What is the time complexity of Merge Sort in the average case?

a)

O(n^2)

b)

O(log n)

c)

O(n log n)

d)

O(n)

47.

Which of the following is a characteristic of a Binary Search Tree (BST)?

a)

All nodes have the same value

b)

The left subtree contains only nodes with values greater than the root

c)

Each node has at most two children

d)

The right subtree contains only nodes with values less than the root

48.

What is the maximum height of an AVL tree with n nodes?

a)

O(1)

b)

O(n log n)

c)

O(n)

d)

O(log n)

49.

In a B-tree of order m, what is the minimum number of keys in a non-root internal node?

a)

m-1

b)

m/2

c)

1

d)

m

50.

What is the primary advantage of using a hash table?

a)

Easier implementation

b)

Better sorting capabilities

c)

Lower memory usage

d)

Faster search times

51.

Which of the following is NOT a method for collision resolution in hash tables?

a)

Binary search

b)

Rehashing

c)

Chaining

d)

Open addressing

52.

What is the main purpose of a skip list?

a)

To store data in a sorted manner

b)

To allow for fast search operations

c)

To create a binary tree structure

d)

To implement a priority queue

53.

In a complete binary tree, how many nodes are there at level l?

a)

l

b)

2^l

c)

2^(l+1)

d)

2^l - 1

54.

What is the balance factor of a node in an AVL tree?

a)

Number of children in left subtree - number of children in right subtree

b)

Height of left subtree - height of right subtree

c)

Height of right subtree - height of left subtree

d)

Total number of nodes in the tree

55.

Which of the following sorting algorithms has the worst-case time complexity of O(n^2)?

a)

Heap Sort

b)

Bubble Sort

c)

Merge Sort

d)

Quick Sort

56.

What is the primary characteristic of a threaded binary tree?

a)

It has no null pointers

b)

It allows for faster in-order traversal

c)

It is always balanced

d)

It can have more than two children

57.

In a hash table, what is a synonym?

a)

A key that maps to the same index

b)

A key that is unique

c)

A key that is deleted

d)

A key that is not found

58.

What is the main advantage of using a B+ tree over a B tree?

a)

B+ trees can have more children

b)

B+ trees are faster for searching

c)

B+ trees do not require balancing

d)

B+ trees use less memory

59.

Which of the following is true about a max heap?

a)

The parent node is always less than its children

b)

All nodes have two children

c)

The tree is always balanced

d)

The parent node is always greater than its children

60.

What is the purpose of the partition operation in Quick Sort?

a)

To merge two sorted arrays

b)

To rearrange elements around the pivot

c)

To count the number of elements

d)

To find the median of the array

61.

In a binary search tree, which traversal method would yield the nodes in sorted order?

a)

In-order

b)

Level-order

c)

Pre-order

d)

Post-order

62.

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)

63.

Which of the following is a property of a B-tree?

a)

It can only have two children per node

b)

It is always a complete tree

c)

It can have a variable number of children

d)

All leaves are at the same level

64.

What is the main disadvantage of using a linked representation for trees?

a)

Wastage of memory

b)

Complex implementation

c)

Slower traversal times

d)

No direct access to nodes

65.

What is the primary function of the merge operation in Merge Sort?

a)

To split the array into sub-arrays

b)

To sort the elements in descending order

c)

To combine two sorted arrays into one

d)

To find the pivot element

66.

In a skip list, what is the purpose of the additional levels?

a)

To store more data

b)

To allow for faster searches

c)

To create a balanced tree

d)

To reduce memory usage

67.

What is the worst-case time complexity of insertion in a hash table using chaining?

a)

O(n)

b)

O(log n)

c)

O(n log n)

d)

O(1)

68.

Which of the following is true about a complete binary tree?

a)

All levels are fully filled except possibly the last

b)

It can have any number of children

c)

It is always balanced

d)

It has a maximum height of n

69.

What is the main purpose of a priority queue?

a)

To store elements in a binary tree

b)

To implement a hash table

c)

To sort elements in ascending order

d)

To manage tasks based on priority

70.

In a B+ tree, where are the data pointers stored?

a)

In both internal and leaf nodes

b)

In a separate structure

c)

In the leaf nodes

d)

In the internal nodes

71.

What is the balance factor of a node in an AVL tree after an insertion?

a)

Always 1

b)

Can be any integer

c)

Always 0

d)

Can be -1, 0, or 1

72.

Which of the following algorithms is NOT a divide and conquer algorithm?

a)

Quick Sort

b)

Binary Search

c)

Merge Sort

d)

Heap Sort

73.

What is the primary characteristic of a max heap?

a)

The root is the largest element

b)

It is a complete binary tree

c)

The root is the smallest element

d)

All leaves are at the same level

74.

Which of the following is true about a hash function?

a)

It must distribute keys uniformly

b)

It must be reversible

c)

It must produce a unique output for every input

d)

It must be a linear function