wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CCDSALG Practice Questions

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Given: sum = 0 for i = 0 to n: for j = 0 to i: sum += j What is the time complexity?

a)

O(n)

b)

O(n log n)

c)

O(n²)

d)

O(n³)

2.

Let f(n) = 4n² + 6n + 1, g(n) = n². Which is true?

a)

f(n) = O(g(n))

b)

f(n) = Ω(g(n))

c)

f(n) = Θ(g(n))

d)

All of the above

3.

Which function has the slowest growth rate?

a)

log²n

b)

√n

c)

n log n

d)

4.

Let f(n) = 10n + 50, and g(n) = n. Which constants satisfy f(n) ≤ cg(n)?

a)

c = 60, n₀ = 1

b)

c = 10, n₀ = 5

c)

c = 12, n₀ = 10

d)

c = 5, n₀ = 20

5.

Convert (3 + 6) * (4 - 2) into prefix:

a)

* + 3 6 - 4 2

b)

+ 3 6 * - 4 2

c)

+ * 3 6 4 2

d)

* 3 6 - 4 2

6.

Quadratic probing, collision at index 2.

What is the probing sequence?

a)

3, 6, 11

b)

3, 7, 2

c)

3, 4, 5

d)

3, 5, 8

7.

Data structure for infix to postfix conversion?

a)

Queue

b)

Stack

c)

Tree

d)

Graph

8.

Binary tree with height 3, full binary tree. Leaf nodes?

a)

2

b)

4

c)

6

d)

8

9.

Which is FALSE about trees?

a)

A tree is a connected acyclic graph.

b)

A tree with n nodes has n edges

c)

A full binary tree has every node with 0 or 2 children.

d)

The number of leaves in a perfect binary tree is 2^h, where h is the height.

10.

Hash table with h(k) = k mod 11. Keys 1, 2, 3 are taken. Where does 45 go?

a)

1

b)

2

c)

4

d)

5

11.

In this Undirected Graph

P---Q

| |

T--- S

\ /

R

What is true?

a)

Tree

b)

Has a cycle

c)

Disconnected

d)

Forest

12.

Which is FALSE in directed graphs?

a)

In-degree is incoming edges

b)

Sum of in-degrees = total edges

c)

Sum of out-degrees = number of nodes

d)

Zero in-degree node can be topological start

13.

Insert into BST: 50, 30, 70, 20, 40, 60, 80. Inorder traversal?

a)

20, 30, 40, 50, 60, 70, 80

b)

50, 30, 20, 40, 70, 60, 80

c)

20, 40, 30, 60, 50, 70, 80

d)

80, 70, 60, 50, 40, 30, 20

14.

BST with 5 descending values. What it its Height?

a)

2

b)

3

c)

4

d)

5

15.

Which data structure is most appropriate to store ticket requests in FCFS order?

a)

Stack

b)

Queue

c)

Graph

d)

Hash Table