Python Algorithms & Security Scripting Quiz 8 questions · 70% to pass 1. What is the worst-case time complexity of linear search on a list of n items? O(1) O(log n) O(n) O(n²) 2. Binary search requires the list to be sorted. Why? Because it was designed for Cisco devices Because it uses the midpoint to decide which half to eliminate — only valid when the data has a meaningful order Because unsorted lists are slower to iterate Because Python's sort() is needed to initialize the search index 3. Python's sorted() function implements Bubble Sort under the hood. True False 4. You need to sort a list of 10,000 security alerts by CVSS score and you need stable sort (equal scores keep their original order). Which approach should you use? Bubble Sort — simple and stable Quick Sort — fastest in practice sorted() with key=lambda a: a.cvss_score — Timsort is stable and O(n log n) Binary Search — O(log n) is faster 5. In Python, what does subprocess.run(['sysctl', '-n', 'kernel.randomize_va_space'], capture_output=True, text=True) do? Reads the file /proc/sys/kernel/randomize_va_space directly Runs the sysctl command and captures its stdout as a Python string Sets the kernel parameter to the value provided Raises an error because sysctl is not a Python module 6. What does oct(Path('/etc/shadow').stat().st_mode)[-3:] return? The file's owner username The file's size in bytes The last three digits of the octal permission string, e.g. '640' The file's modification timestamp 7. In the arc-sec-audit OOP structure, what is the role of the base Auditor class? It implements each of the nine security checks directly It holds shared state (counters) and helpers (ok/warn/fail/run) so each check module stays flat and focused It connects to the network devices via SSH It replaces the need for subprocess by reimplementing shell commands in Python 8. Merge Sort uses O(n) extra memory. Which algorithm is O(1) space (in-place) and still runs in O(n log n)? Bubble Sort Radix Sort Heap Sort Insertion Sort Submit Quiz Back to Chapter Back to Chapter Dashboard