wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Algorithm and Complexity Quiz

Total questions: 27

Worksheet time: 14mins

Name
Class
Date
1.

What notation is used to describe the upper bound of an algorithm's time complexity?

a)

Big-O

b)

Big-Ω

c)

Big-Θ

d)

Little-o

2.

Which algorithm is used for finding the greatest common divisor (GCD)?

a)

Merge sort

b)

Euclidean algorithm

c)

Fibonacci sequence

d)

Sieve of Eratosthenes

3.

What is the primary technique used in the KMP algorithm?

a)

Backtracking

b)

Dynamic programming

c)

Pattern matching

d)

Greedy approach

4.

Which of the following is a divide and conquer algorithm?

a)

Quick sort

b)

Huffman coding

c)

Activity selection

d)

0/1 knapsack

5.

What does the Master Theorem help analyze?

a)

Recurrence relations

b)

Sorting algorithms

c)

Bit manipulation

d)

Graph connectivity

6.

Which of the following is a classical dynamic programming problem?

a)

Merge sort

b)

Longest common subsequence (LCS)

c)

Binary search

d)

Dijkstra's algorithm

7.

What is the main advantage of memoization in dynamic programming?

a)

Eliminates recursion

b)

Simplifies code

c)

Increases space complexity

d)

Reduces time complexity

8.

Which algorithm is used for cycle detection in graphs?

a)

Dijkstra's algorithm

b)

Bellman-Ford

c)

Depth-first search

d)

Merge sort

9.

What is the purpose of backtracking in algorithms?

a)

To sort data efficiently

b)

To explore all possible solutions

c)

To find the shortest path

d)

To optimize space complexity

10.

Which of the following problems is NP-Hard?

a)

Fibonacci sequence

b)

Merge sort

c)

Binary search

d)

0/1 knapsack

11.

What does the term 'greedy-choice property' refer to?

a)

Dividing problems into subproblems

b)

Using dynamic programming

c)

Exploring all possibilities

d)

Choosing the best option at each step

12.

Which algorithm is used for finding the longest palindromic substring?

a)

Binary search

b)

Dynamic programming

c)

Rabin-Karp

d)

KMP

13.

What is the time complexity of merge sort?

a)

O(log n)

b)

O(n log n)

c)

O(n^2)

d)

O(n)

14.

Which of the following is a bit manipulation operation?

a)

Pattern matching

b)

Finding GCD

c)

Sorting an array

d)

AND operation

15.

What is the main goal of the Sieve of Eratosthenes?

a)

Calculating GCD

b)

Sorting numbers

c)

Finding prime numbers

d)

Finding the longest substring

16.

Which algorithm is used for job sequencing?

a)

Divide and conquer

b)

Backtracking

c)

Greedy algorithm

d)

Dynamic programming

17.

What is the primary focus of the Bellman-Ford algorithm?

a)

Sorting data

b)

Finding the shortest path

c)

Finding prime numbers

d)

Searching for elements

18.

Which of the following is a property of NP-Complete problems?

a)

Can be verified in polynomial time

b)

Can be solved in polynomial time

c)

Are always solvable

d)

Always have a unique solution

19.

What is the purpose of the Z-algorithm?

a)

Pattern matching

b)

Sorting

c)

Graph traversal

d)

Dynamic programming

20.

Which of the following is NOT a string algorithm?

a)

KMP

b)

Merge sort

c)

Rabin-Karp

d)

Z-algorithm

21.

What does the term 'asymptotic analysis' refer to?

a)

Analyzing algorithms for large inputs

b)

Finding the best algorithm

c)

Analyzing algorithms for small inputs

d)

Comparing different algorithms

22.

Which of the following is a backtracking problem?

a)

Binary search

b)

Sudoku solver

c)

Fibonacci sequence

d)

Merge sort

23.

What is the main characteristic of a greedy algorithm?

a)

It always finds the optimal solution

b)

It makes the best choice at each step

c)

It uses recursion

d)

It divides problems into subproblems

24.

Which of the following is a method for checking connectivity in graphs?

a)

Depth-first search

b)

Merge sort

c)

Binary search

d)

Dynamic programming

25.

What is the time complexity of the closest pair of points algorithm?

a)

O(n^2)

b)

O(log n)

c)

O(n)

d)

O(n log n)

26.

Which of the following is a property of the 0/1 knapsack problem?

a)

Can take only whole items

b)

Is always solvable

c)

Can take multiple items

d)

Can take fractional items

27.

What is the main purpose of the Trie data structure?

a)

Sorting data

b)

Searching for strings

c)

Finding prime numbers

d)

Graph traversal