ALGORITHMS PRACTICE EXAMINATION
2026 QUESTIONS WITH ANSWERS
GRADED A+
◍ Backtracking Algorithm.
Answer: A trial-and-error technique used to explore potential solutions by
undoing choices when they lead to an incorrect outcome,.
◍ Hash Table Bucket.
Answer: An array element in a hash table.
◍ Double.
Answer: Which data type does the mystery function return?return_type
mystery (int R){int NumUnits = R;return NumUnits * 3.14;}
◍ Searching Algorithm.
Answer: Designed to find a specific target within a dataset, enabling
efficient retrieval of information from sorted or unsorted collections.
◍ Returns true if the specified value exists in the list, false otherwise.
Answer: Contains
◍ self-adjusting heuristic.
Answer: modifies based on how data is used
◍ Bellman-Ford shortest path algorithm.
Answer: created by Richard Bellman and Lester Ford, Jr., determines the
shortest path from a start vertex to each vertex in a graph.
◍ Adds the specified item to the linked list in the sort order of the item type.
Answer: Add
,◍ Which function in Python is used to find a specific value in a tuple?.
Answer: index()
◍ hashKey() method.
Answer: returns a non-negative integer hash code for a key.
◍ lambda function.
Answer: provides a shorthand notation for creating a function object.
◍ PushFront(deque, x).
Answer: Inserts x at the front of the dequePushFront(deque, 41). Deque: 41,
59, 63, 19
◍ max-heap.
Answer: a complete binary tree that maintains the simple property that a
node's key is greater than or equal to the node's children's keys. (Actually, a
max-heap may be any tree, but is commonly a binary tree).
◍ my_list[:].
Answer: Get a copy of the list.
◍ direct access table.
Answer: A hash table with a direct hash function.
◍ Tuple.
Answer: A data type behaves similar to a list but is immutable - once created
the elements cannot be changed.
◍ shortest path.
Answer: shortest route from start point to end point
◍ base case.
Answer: Every recursive function must have a case that returns a value
without performing a recursive call.
◍ The left and right children are visited before the node.
Answer: Post-order
◍ Each link in a chain for a linked lists is called a ______.
, Answer: node
◍ Which category of data does ("FB", 75.00, 75.03, 74.90) represent in the
pseudocode? import datetimedef middle(stock, date): symbol, current, high,
low = stock return (((high + low) / 2), date) mid_value, date =
middle(("FB", 75.00, 75.03, 74.90), datetime.date(2014, 10, 31)).
Answer: Tuple
◍ What is the output of the pseudocode below if the variables declared in the
main program are global? Main Declare X as Integer, Y as Integer Set X = 1
Set Y = 2 Call Sub(X, Y) Write X Write YEnd ProgramSubprogram
Sub(Integer Num1, Integer Num2 as Reference) Declare X as Integer Set
Num1 = 3 Set Num2 = 4 Set X = 5 Write XEnd Subprogram.
Answer: 514
◍ Selection Sort.
Answer: Treats the input as 2 parts (sorted and unsorted). It finds the lowest
value and swaps it with the current element, moving it from unsorted to the
end of the sorted part.Selection sort has the same runtime complexity for all
scenarios O(n^2)
◍ How many vertices does this graph have?.
Answer: five
◍ Data structure.
Answer: A way of organizing, storing, and performing operations on data.
Operations include accessing or updating stored data, searching for specific
data, inserting new data, and removing data.
◍ Max-Heap.
Answer: A binary tree that maintains the simple property that a node's key is
greater than or equal to the node's childrens' keys. (Actually, a max-heap
may be any tree, but is commonly a binary tree).*a max-heap's root always
has the maximum key in the entire tree.
◍ PopFront(deque).
Answer: Returns and removes item at front of dequePopFront(deque) returns