Algorithms Technology & Digital Applications 3 — Questions and Answers
Question 1: A spam filter scores emails and marks those above a threshold as spam. Which algorithmic concept does this threshold represent?
- Pivot element
- Decision boundary (Correct answer)
- Sentinel value
- Hash seed
Correct answer: Decision boundary
A decision boundary separates two classes (spam/not spam) based on a computed score, a core concept in classification algorithms.
Question 2: Version control systems like Git compute a compact fingerprint for each commit to detect changes. What is this fingerprint called?
- B-tree index
- Cryptographic hash (Correct answer)
- Adjacency list
- Bitwise XOR
Correct answer: Cryptographic hash
Git uses SHA-1/SHA-256 cryptographic hashes to uniquely identify each commit and detect any file corruption.
Question 3: A database executes a JOIN between two tables. Which algorithmic technique improves performance when both tables are already sorted on the join key?
- Nested loop join
- Merge join (Correct answer)
- Hash join
- Radix join
Correct answer: Merge join
Merge join exploits sorted order to scan both tables linearly, achieving O(n + m) instead of O(n x m).
Question 4: A CDN caches only the most recently requested files and evicts the oldest when full. What cache eviction policy is this?
- Least Frequently Used (LFU)
- Least Recently Used (LRU) (Correct answer)
- First In First Out (FIFO)
- Random Replacement
Correct answer: Least Recently Used (LRU)
LRU evicts the item that was least recently accessed, keeping hot content in cache.
Question 5: A file compression tool reduces a text file from 10 MB to 4 MB. Which algorithm likely achieves the best compression for natural-language text?
- Selection Sort
- Huffman Coding (Correct answer)
- Linear Search
- Floyd-Warshall
Correct answer: Huffman Coding
Huffman Coding assigns shorter bit codes to more frequent characters, efficiently compressing natural-language text.
Question 6: An online game uses a leaderboard where player scores are inserted and the top-10 must be retrieved instantly. Which data structure is optimal?
- Unsorted array
- Min-heap of size 10 (Correct answer)
- Singly linked list
- Stack
Correct answer: Min-heap of size 10
A min-heap of size 10 maintains the top-10 scores with O(log 10) insertion and instant top retrieval.
Question 7: A ride-sharing app matches riders to the nearest available driver. What class of algorithm solves this assignment problem optimally?
- Bipartite matching algorithm (Correct answer)
- Quicksort
- Depth-First Search
- Radix Sort
Correct answer: Bipartite matching algorithm
Bipartite matching algorithms like the Hungarian method optimally pair riders and drivers across two disjoint sets.
A spam filter scores emails and marks those above a threshold as spam.
Which algorithmic concept does this threshold represent?