Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Understanding Data Structures Quiz

Total questions: 24

Worksheet time: 15mins

Name
Class
Date
1.

Which data structure operates on a Last-In, First-Out (LIFO) principle?

a)

Queue

b)

Stack

c)

Hash Table

d)

Vector

2.

What is the main difference between a stack and a queue?

a)

Stack is FIFO, Queue is LIFO

b)

Stack is LIFO, Queue is FIFO

c)

Both are LIFO

d)

Both are FIFO

3.

Which operation removes the front element from a queue?

a)

Pop

b)

Dequeue

c)

Push

d)

Peek

4.

In a binary tree, what is the maximum number of children a node can have?

a)

1

b)

2

c)

3

d)

4

5.

Which traversal method visits the left subtree, then the root, then the right subtree in a binary tree?

a)

Pre-order

b)

In-order

c)

Post-order

d)

Level-order

6.

What is the primary advantage of using a hash table?

a)

Maintains order of elements

b)

Fast data retrieval

c)

Uses less memory

d)

Easy to implement

7.

Which data structure is best suited for implementing undo functionality in software?

a)

Queue

b)

Stack

c)

Hash Table

d)

Vector

8.

What is the main benefit of a balanced binary search tree compared to an unbalanced one?

a)

It uses less memory

b)

It keeps data more organised for faster searching

c)

It allows duplicate values

d)

It is easier to implement

9.

Which of the following is NOT a valid operation on a stack?

a)

Push

b)

Pop

c)

Enqueue

d)

Peek

10.

What is the main purpose of a hash function in a hash table?

a)

To sort data

b)

To map keys to addresses

c)

To compress data

d)

To encrypt data

11.

What are the nodes at the bottom of a tree called?

a)

Parents

b)

Children

c)

Root

d)

Leaves

12.

Always undirected with no loops

a)

Tree

b)

Graph

c)

Stack

d)

Hash Table

13.

What is a collision in a hash table?

a)

When two keys map to the same index

b)

When a key cannot be found

c)

When the table is full

d)

When the hash function fails

14.

What type of queue allows certain elements to jump to the front?

(a)  

15.

Which traversal method visits the root node first in a binary tree?

a)

In-order

b)

Pre-order

c)

Post-order

d)

Level-order

16.

Which of the following is NOT a property of a binary search tree?

a)

Left child is less than parent

b)

Right child is greater than parent

c)

All nodes have two children

d)

No duplicate values

17.

When inserting an element into a hash table with a good hash function, what is the expected result?

a)

The element is placed quickly at its calculated position

b)

The element is always placed at the end

c)

The element is sorted with others

d)

The element is always placed at the start

18.

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

a)

Faster access

b)

Dynamic resizing

c)

Less memory usage

d)

Easier sorting

19.

Which operation adds an element to the end of a queue?

a)

Push

b)

Enqueue

c)

Pop

d)

Peek

20.

In a graph, what is a cycle?

a)

A path that starts and ends at the same vertex

b)

A path that visits every vertex once

c)

A path with no repeated vertices

d)

A path with only one edge

21.

Which of the following is NOT a valid use case for a hash table?

a)

Storing unique keys

b)

Fast lookup

c)

Maintaining sorted order

d)

Handling collisions

22.

What is the parent of a node in a tree?

a)

The node directly above it

b)

The node directly below it

c)

Any node in the tree

d)

The root node

23.

Apply the scalar of 2.5 to the following vector

(7, 3, 2, 8)

(a)  

24.

For convex combination, what constraint is applied to the values of What constraint is applied to the values of α and β?

4 lines