wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structures and Algorithms Quiz

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

What is a Data Structure?

a)

A programming language

b)

A way to organize and store data

c)

A computer hardware component

d)

None of the above

2.

Which of the following is an example of an algorithm?

a)

Hash table

b)

Binary Search

c)

Stack

d)

Queue

3.

Which data structure allows O(1) access time?

a)

Linked list

b)

Array

c)

Stack

d)

Queue

4.

In linked lists, what connects nodes together?

a)

Indices

b)

Pointers

c)

Arrays

d)

Variables

5.

Which structure is best for dynamic insertion and deletion?

a)

Array

b)

Linked List

c)

Stack

d)

Hash table

6.

Which linked list allows traversal in both directions?

a)

Singly linked list

b)

Doubly linked list

c)

Circular linked list

d)

Static list

7.

What defines a Circular Linked List?

a)

No NULL pointer

b)

Last node points to first

c)

Random connections

d)

Uses arrays internally

8.

What type of structure is a Stack?

a)

FIFO

b)

LIFO

c)

Random Access

d)

Priority Based

9.

Which structure works on FIFO principle?

a)

Stack

b)

Queue

c)

Array

d)

Tree

10.

Which is used for scheduling printer jobs?

a)

Stack

b)

Queue

c)

Hash Table

d)

Graph

11.

Which data structure is best for undo operations?

a)

Queue

b)

Stack

c)

Array

d)

Graph

12.

Which queue prioritizes elements?

a)

Stack

b)

Priority Queue

c)

Circular Queue

d)

Simple Queue

13.

In a BST, left subtree values are:

a)

Greater

b)

Smaller

c)

Random

d)

Equal

14.

Time complexity for search in balanced BST:

a)

O(n)

b)

O(log n)

c)

O(1)

d)

O(n log n)

15.

Which tree maintains balance using rotations?

a)

BST

b)

AVL Tree

c)

Binary Tree

d)

Trie

16.

Red-Black Trees are used in:

a)

TreeSet in Java

b)

Arrays

c)

Linked Lists

d)

Stack

17.

Graphs are made of:

a)

Nodes and indices

b)

Vertices and Edges

c)

Arrays and Pointers

d)

Trees and Leaves

18.

Which algorithm finds shortest paths in unweighted graphs?

a)

DFS

b)

BFS

c)

Dijkstra

d)

Kruskal

19.

Dijkstra’s algorithm works on:

a)

Unweighted graphs

b)

Weighted graphs

c)

Trees only

d)

Linked lists

20.

Which finds Minimum Spanning Tree?

a)

BFS

b)

Kruskal's Algorithm

c)

DFS

d)

Binary Search

21.

Hash tables store data using:

a)

Trees

b)

Hash functions

c)

Arrays

d)

Linked lists only

22.

Which resolves collision by chaining?

a)

Hash table

b)

Stack

c)

Queue

d)

BST

23.

A trie is used in:

a)

Sorting

b)

Autocomplete

c)

Hashing

d)

Stacks

24.

Heaps are used in:

a)

Priority Queues

b)

Hashing

c)

Graphs

d)

Arrays

25.

Disjoint sets are used in:

a)

BFS

b)

Kruskal’s Algorithm

c)

DFS

d)

Hashing

26.

Merge sort complexity:

a)

O(n)

b)

O(n log n)

c)

O(log n)

d)

O(n^2)

27.

Quick Sort is based on:

a)

BFS

b)

Divide and Conquer

c)

Greedy

d)

DP

28.

Binary search works on:

a)

Any array

b)

Sorted array

c)

Linked list

d)

Stack

29.

Dynamic Programming solves:

a)

Independent subproblems

b)

Overlapping subproblems

c)

Unrelated tasks

d)

Graphs only

30.

Memoization reduces:

a)

Space

b)

Redundant computation

c)

Stack size

d)

Queue size

31.

Sparse matrices are mostly:

a)

Full

b)

Zero elements

c)

Sorted

d)

Hashed

32.

Huffman coding is used for:

a)

Encryption

b)

Compression

c)

Searching

d)

Sorting

33.

Greedy algorithms make:

a)

Global choices

b)

Local optimal choices

c)

Random decisions

d)

Backtracking steps

34.

Backtracking is used in:

a)

Sorting

b)

N-Queens problem

c)

BFS

d)

Hashing

35.

Knapsack is solved using:

a)

BFS

b)

Dynamic Programming

c)

DFS

d)

Stacks

36.

Bellman-Ford handles:

a)

Only positive weights

b)

Negative weights

c)

Trees only

d)

Sparse graphs

37.

Floyd-Warshall finds:

a)

Single pair shortest path

b)

All pairs shortest path

c)

MST

d)

LCS

38.

Topological sorting applies to:

a)

Trees

b)

DAG

c)

Cyclic graphs

d)

Stacks

39.

Prim's algorithm is used for:

a)

Shortest path

b)

Minimum Spanning Tree

c)

Sorting

d)

Searching

40.

A perfect hash function has:

a)

Many collisions

b)

No collisions

c)

Random results

d)

High complexity

41.

Bloom filter may have:

a)

False positives

b)

False negatives

c)

Both

d)

None

42.

B-Trees are used in:

a)

Linked lists

b)

Databases

c)

Arrays

d)

Graphs

43.

Segment trees are used for:

a)

Sorting

b)

Range queries

c)

Hashing

d)

BFS

44.

Fenwick trees help in:

a)

Range updates

b)

Prefix sums

c)

Sorting

d)

Hashing

45.

Longest Common Subsequence (LCS) is used in:

a)

Graphs

b)

DNA alignment

c)

Trees

d)

Hashing

46.

Deque allows insertion from:

a)

Front only

b)

Rear only

c)

Both ends

d)

Middle

47.

Circular queue is used in:

a)

Stack

b)

Traffic light systems

c)

Sorting

d)

Trees

48.

Big O notation gives:

a)

Exact time

b)

Upper bound

c)

Lower bound

d)

Average time

49.

Tail recursion helps in:

a)

Using more stack

b)

Constant stack space

c)

More memory

d)

More recursion depth

50.

Bitmask represents:

a)

Arrays

b)

Subsets

c)

Linked lists

d)

Trees