ALGORITHMS OBJECTIVE V1 AND V2
ACTUAL EXAM PAPER 2026 QUESTIONS
WITH ANSWERS GRADED A+
◍ Which Python list function will remove all items from a list?.
Answer: clear()
◍ List.
Answer: Which abstract data type (ADT) has elements of the same type so
that the elements can be retrieved based on the index or position?
◍ Difference.
Answer: Returns a set containing only the elements of set that are not found
in any of the provided sets.
◍ Algorithm.
Answer: A sequence of steps for accomplishing a task.
◍ O(logn).
Answer: Big-OBinarySearch(numbers, N, key) { mid = 0 low = 0 high = N -
1 while (high >= low) { mid = (high + low) / 2 if (numbers[mid] < key) {
low = mid + 1 } else if (numbers[mid] > key) { high = mid - 1 } else {
return mid } } return -1 // not found}
◍ identity.
Answer: unique identifier that describes the object
◍ Time complexity.
Answer: amount of time needed to execute codeincludes an algorithms
worst case
,◍ Min-Heap.
Answer: Similar to a max-heap, but a node's key is less than or equal to its
children's keys.
◍ When smaller values are added to this tree smaller values are added to the
left.
Answer: Binary Search Tree
◍ A modulo hash function for a 50 entry hash table is: key % _____.
Answer: 50
◍ Assignment vs comparison.
Answer: = vs ==
◍ set - intersection.
Answer: The intersection of sets X and Y, denoted as X ∩ Y, is a set that
contains every element that is in both X and Y, and no additional elements.
◍ Which of the following Big O Notations is equivalent to O(N+999)?.
Answer: O(N)
◍ Heap.
Answer: A complete binary tree-based data structure.
◍ Push(PQueue, x).
Answer: Inserts x after all equal or higher priority itemsExample starting
with priority queue: 42, 61, 98 (front is 42)Push(PQueue, 87). PQueue: 42,
61, 87, 98
◍ (high + low)/2.
Answer: mid-values calculation for binary search. toCeil()
◍ Algorithm efficiency.
Answer: Typically measured by the algorithm's computational complexity.
◍ Set.
Answer: An ADT for a collection of distinct items. (no dups!)Underlying
data structures: Binary search tree, Hash table
, ◍ What is a component of an algorithm that specifies a stopping point?.
Answer: Finiteness
◍ operator overloading.
Answer: This technique of Class customization can redefine the
functionality of built-in operators like <, >=, +, -, and * when used with
class instances.
◍ O(n.
Answer: What is the time complexity of this pseudocode?double
sumCol(double table[][], int numRows, int numCols, int col){ double cSum
= 0; for (int row = 0; row < numRows; row++) { cSum += table[row][col]; }
return cSum;}
◍ Linked List.
Answer: A data structure that stores an ordered list of items in nodes, where
each node stores data and has a pointer to the next node.
◍ Hashing.
Answer: mapping each item to a location in an array (in a hash table).
◍ Perfect Hash Function.
Answer: A hash function which maps items into buckets with no collisions.
The runtime for insert, search and remove is O(1) with a perfect hash
function.
◍ If an object is assigned to null (int = null;), will the object be considered for
garbage collection?.
Answer: Yes (it's considered for garbage collection right once it's assigned
to null)
◍ Which of the following Big O Notations is equivalent to
O(12*N)+6(N^3+1000)?.
Answer: O(N^3)
◍ while loop.
Answer: A ______ executes a block of code as long as the loop's expression