wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PrelimExam-DSA-FCPC

Total questions: 30

Worksheet time: 30mins

Name
Class
Date
1.

What is the time complexity of accessing an element in a Python list by index?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n²)

2.

What is the average time complexity of searching for an element in an unsorted linked list?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

3.

The time complexity of appending an element to a Python list (average case) is:

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n²)

4.

Which operation on a singly linked list requires O(n) time?

a)

Traversal

b)

Access by index

c)

Searching

d)

All of the above

5.

Which of the following is the best case time complexity of inserting at the head of a linked list?

a)

O(n)

b)

O(log n)

c)

O(1)

d)

O(n²)

6.

What is the space complexity of storing a string of length n in Python?

a)

O(1)

b)

O(n)

c)

O(n²)

d)

O(log n)

7.

Which operation in Python strings has O(n) complexity?

a)

Indexing

b)

Concatenation

c)

Slicing

d)

Both b and c

8.

What is the worst-case time complexity of deleting a node from the middle of a singly linked list?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n²)

9.

In a singly linked list, each node contains:

a)

Only data

b)

Data and pointer to next node

c)

Data and pointer to previous node

d)

Both b and c

10.

What is the average-case time complexity of searching an element in a Python list?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n²)

11.

Which complexity class grows fastest as n increases?

a)

O(log n)

b)

O(n)

c)

O(n log n)

d)

O(2^n)

12.

Which of the following has O(1) time complexity?

a)

Accessing element by index in a list

b)

Adding at the head of a linked list

c)

Assigning a value to a variable

d)

All of the above

13.

Which of the following is the slowest growth rate?

a)

O(1)

b)

O(log n)

c)

O(n)

d)

O(n²)

14.

Which of the following is NOT a characteristic of Big-O notation?

a)

Describes upper bound

b)

Ignores constant factors

c)

Depends on hardware

d)

Expresses algorithm efficiency

15.

If an algorithm's running time doubles when the input size doubles, its complexity is most likely:

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n²)

16.

Which is more efficient for inserting at the beginning?

a)

Python list

b)

Linked list

c)

Both are equal

d)

Depends on input size

17.

What is the time complexity of finding the length of a Python list using len()?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n²)

18.

What is the time complexity of checking if a string s1 is a substring of s2 (length n)?

a)

O(1)

b)

O(log n)

c)

O(n)

d)

O(n²)

19.

In a doubly linked list, each node contains:

a)

Data and one pointer

b)

Data and two pointers

c)

Only data

d)

None of the above

20.

Which of the following is the best case complexity of searching in an unsorted list?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n²)

21.

Accessing an element in a linked list by index is O(1).

a)

TRUE

b)

FALSE

22.

String concatenation using + inside a loop is efficient.

a)

TRUE

b)

FALSE

23.

Searching an element in a Python list is O(n).

a)

TRUE

b)

FALSE

24.

A doubly linked list node has two pointers.

a)

TRUE

b)

FALSE

25.

In Big-O, constants are ignored.

a)

TRUE

b)

FALSE

26.

Removing from the head of a singly linked list is O(1).

a)

TRUE

b)

FALSE

27.

Indexing a Python string is O(n).

a)

TRUE

b)

FALSE

28.

Traversal of a list or linked list is O(n).

a)

TRUE

b)

FALSE

29.

Appending to a linked list tail with no tail pointer is O(1).

a)

TRUE

b)

FALSE

30.

O(n log n) grows slower than O(n²).

a)

TRUE

b)

FALSE