NEW
Font size
WorksheetsPrelimExam-DSA-FCPC
Total questions: 30
Worksheet time: 30mins
What is the time complexity of accessing an element in a Python list by index?
O(1)
O(n)
O(log n)
O(n²)
What is the average time complexity of searching for an element in an unsorted linked list?
O(1)
O(n)
O(log n)
O(n log n)
The time complexity of appending an element to a Python list (average case) is:
O(1)
O(n)
O(log n)
O(n²)
Which operation on a singly linked list requires O(n) time?
Traversal
Access by index
Searching
All of the above
Which of the following is the best case time complexity of inserting at the head of a linked list?
O(n)
O(log n)
O(1)
O(n²)
What is the space complexity of storing a string of length n in Python?
O(1)
O(n)
O(n²)
O(log n)
Which operation in Python strings has O(n) complexity?
Indexing
Concatenation
Slicing
Both b and c
What is the worst-case time complexity of deleting a node from the middle of a singly linked list?
O(1)
O(n)
O(log n)
O(n²)
In a singly linked list, each node contains:
Only data
Data and pointer to next node
Data and pointer to previous node
Both b and c
What is the average-case time complexity of searching an element in a Python list?
O(1)
O(n)
O(log n)
O(n²)
Which complexity class grows fastest as n increases?
O(log n)
O(n)
O(n log n)
O(2^n)
Which of the following has O(1) time complexity?
Accessing element by index in a list
Adding at the head of a linked list
Assigning a value to a variable
All of the above
Which of the following is the slowest growth rate?
O(1)
O(log n)
O(n)
O(n²)
Which of the following is NOT a characteristic of Big-O notation?
Describes upper bound
Ignores constant factors
Depends on hardware
Expresses algorithm efficiency
If an algorithm's running time doubles when the input size doubles, its complexity is most likely:
O(1)
O(n)
O(log n)
O(n²)
Which is more efficient for inserting at the beginning?
Python list
Linked list
Both are equal
Depends on input size
What is the time complexity of finding the length of a Python list using len()?
O(1)
O(n)
O(log n)
O(n²)
What is the time complexity of checking if a string s1 is a substring of s2 (length n)?
O(1)
O(log n)
O(n)
O(n²)
In a doubly linked list, each node contains:
Data and one pointer
Data and two pointers
Only data
None of the above
Which of the following is the best case complexity of searching in an unsorted list?
O(1)
O(n)
O(log n)
O(n²)
Accessing an element in a linked list by index is O(1).
TRUE
FALSE
String concatenation using + inside a loop is efficient.
TRUE
FALSE
Searching an element in a Python list is O(n).
TRUE
FALSE
A doubly linked list node has two pointers.
TRUE
FALSE
In Big-O, constants are ignored.
TRUE
FALSE
Removing from the head of a singly linked list is O(1).
TRUE
FALSE
Indexing a Python string is O(n).
TRUE
FALSE
Traversal of a list or linked list is O(n).
TRUE
FALSE
Appending to a linked list tail with no tail pointer is O(1).
TRUE
FALSE
O(n log n) grows slower than O(n²).
TRUE
FALSE
