Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structures and Algorithm Quiz

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

Which of the following is a limitation of the Array-based List ADT?

a)

Slow random access

b)

Fixed maximum size

c)

Expensive lookup

d)

Poor memory locality

2.

What is the time complexity for inserting an element at the beginning of a singly linked list?

a)

O(n)

b)

O(1)

c)

O(log n)

d)

O(n2)O(n^2)

3.

Which linked list supports insertion at both ends with O(1) efficiency?

a)

Singly linked

b)

Circular singly linked

c)

Doubly linked

d)

Array

4.

What is the main use of a multilist structure?

a)

Binary search

b)

Multiple linked lists sharing nodes

c)

Recursive sorting

d)

Array-based priority queue

5.

Radix sort is best used for:

a)

Sorting floating point numbers

b)

Sorting integers with a fixed number of digits

c)

Sorting linked lists

d)

Sorting trees

6.

Which data structure helps in evaluating postfix expressions?

a)

Queue

b)

Stack

c)

Dequeue

d)

Linked list

7.

In which application is a queue used?

a)

Undo feature in editors

b)

Call center waiting management

c)

Recursion

d)

Directory traversal

8.

A circular queue helps in:

a)

Preventing queue overflow when space is available

b)

Non-repeating dequeue

c)

Infinite stack

d)

Nested function calls

9.

The operation to remove an item from the front of a queue is:

a)

Dequeue

b)

Pop

c)

Enqueue

d)

Insert

10.

Dequeue data structure allows:

a)

Removal only at rear

b)

Insertion only at rear

c)

Insertion and removal at both ends

d)

Insertion only at front

11.

Which data structure supports efficient searching, insertion, and deletion?

a)

Binary Search Tree

b)

Singly linked list

c)

Stack

12.

What is the maximum number of children a binary tree node can have?

a)

1

b)

2

c)

3

d)

Any

13.

In which traversal of a binary tree is the root visited first?

a)

Inorder

b)

Preorder

c)

Postorder

d)

Level Order

14.

An AVL tree always maintains:

a)

Perfect balance

b)

Height balance

c)

No duplicates

d)

Threaded pointers

15.

Which of these is not a binary tree property?

a)

Each node has at most two children

b)

Root node has no parents

c)

Node degree can be more than 2

d)

Traversals can be recursive

16.

Which algorithm is applied for constructing an expression tree from postfix expression?

a)

Stack-based

b)

Queue-based

c)

List-based

d)

BFS-based

17.

Binary heaps are used for which abstract data type?

a)

Priority queue

b)

Binary search tree

c)

Array list

d)

Doubly linked list

18.

What operation does not require tree balancing in AVL tree?

a)

Insertion

b)

Traversal

c)

Deletion

d)

Rotations

19.

The shape of a binary heap is always:

a)

Complete binary tree

b)

Skewed binary tree

c)

Unordered tree

d)

Balanced tree with duplicates

20.

The height of a binary tree with one node is:

a)

0

b)

1

c)

2

d)

-1

21.

A B-tree of order m can have at most ___ children per node.

a)

m

b)

m-1

c)

m+1

d)

2m

22.

The root node in a B-tree must have at least:

a)

1 key

b)

2 keys

c)

m/2 keys

d)

m keys

23.

Which one of the following is not a representation of a graph?

a)

Adjacency matrix

b)

Adjacency list

24.

Which traversal is guaranteed to visit every vertex exactly once in a connected graph?

a)

BFS

b)

DFS

c)

Topological sort

d)

Both a and b

25.

What is the distinguishing property of a B+ tree?

a)

All keys in leaves

b)

Non-leaf nodes have data

c)

No hierarchical structure

d)

Duplicate keys in internal nodes

26.

Topological sorting is possible only in:

a)

Undirected graphs

b)

Cyclic graphs

c)

Connected graphs

d)

DAGs

27.

Which algorithm efficiently finds the shortest path in a weighted undirected graph with non-negative edges?

a)

BFS

b)

Dijkstra’s algorithm

c)

Prim’s algorithm

d)

Kruskal’s algorithm

28.

Which minimum spanning tree algorithm works by adding edges in increasing cost order?

a)

Dijkstra’s algorithm

b)

Kruskal’s algorithm

c)

Prim’s algorithm

d)

Topological sort

29.

The degree of a vertex in a graph is:

a)

Number of edges incident to it

b)

Number of vertices

c)

Number of loops

d)

None

30.

An Euler circuit exists in a connected undirected graph if:

a)

Each vertex has even degree

b)

Graph is acyclic

c)

At least one odd degree vertex

d)

No cycles

31.

Breadth-first traversal uses which data structure?

a)

Stack

b)

Queue

c)

List

d)

Heap

32.

Which representation is most space-efficient for sparse graphs?

a)

Incidence matrix

b)

Adjacency matrix

c)

Adjacency list

d)

Edge list

33.

Which traversal is suitable for detecting cycles in a graph?

a)

Inorder

b)

Level Order

c)

Depth-first traversal

d)

Preorder

34.

Which of the following is a characteristic of a strongly connected directed graph?

a)

There’s a path from every vertex to every vertex

b)

All edges are bidirectional

c)

Has a single vertex

d)

Cannot have cycles

35.

In a B+ tree, which level stores all data records?

a)

Root

b)

Leaf

c)

Internal nodes

d)

Random nodes

36.

Which is not true of graphs?

a)

Edges may be directed or undirected

b)

Vertices can be isolated

c)

Each edge must form a cycle

d)

Weights may be assigned to edges

37.

Topological sort is used for:

a)

Scheduling tasks with dependencies

b)

Shortest path

c)

Spanning tree

d)

Detecting cycles

38.

The minimum number of edges for a connected undirected graph with n vertices is:

a)

n-1

b)

n

c)

n+1

d)

2n

39.

Which traversal covers all vertices reachable from a source in graph?

a)

BFS

b)

Inorder traversal

c)

AVL traversal

d)

Heap traversal

40.

Always choosing the smallest weight edge connecting to the tree

a)

Sorting all edges

b)

Removing large edges

c)

Adding random edges

41.

Merge sort works fastest when:

a)

Data is already sorted

b)

List size is large

c)

Data is in random order

d)

There are duplicate values

42.

Binary search is not applicable when:

a)

List is sorted

b)

List is unsorted

c)

Elements are unique

d)

Only integers are stored

43.

Which sorting algorithm is in-place and not stable?

a)

Insertion sort

b)

Selection sort

c)

Merge sort

d)

Bubble sort

44.

Which sorting method doesn’t use comparisons?

a)

Bubble sort

b)

Insertion sort

c)

Counting sort

d)

Selection sort

45.

Open addressing resolves hashing collisions by:

a)

Storing colliding values in new buckets by re-probing

b)

Chaining values

c)

Sorting the table

d)

Creating a new hash function

46.

A good hash function should:

a)

Map all keys to the same value

b)

Minimize collisions

c)

Be slow

d)

Ignore key input

47.

Rehashing the hash table is needed when:

a)

The load factor is too high

b)

Table is empty

48.

In separate chaining, collisions in hash tables are resolved by:

a)

Linear search

b)

Using buckets as linked lists

c)

Inserting at random

d)

Resizing the array

49.

Quick sort’s average case complexity is:

a)

O(n)

b)

O(n log n)

c)

O(n2)O(n^2)

d)

O(log n)

50.

In separate chaining, collisions in hash tables are resolved by:

a)

a) Linear search

b)

b) Using buckets as linked lists

c)

c) Inserting at random

d)

d) Resizing the array