trevor.anderson
trevor.anderson 8h ago β€’ 0 views

Multiple Choice Questions on Algorithms for AP CSP Exam Prep

Hey there! πŸ‘‹ Prepping for the AP CSP exam and need to brush up on your algorithm knowledge? No sweat! I've got a quick study guide and a practice quiz to help you ace it. Let's dive in! πŸ’»
πŸ’» Computer Science & Technology

1 Answers

βœ… Best Answer
User Avatar
craig.kelly Dec 28, 2025

πŸ“š Quick Study Guide

    πŸ” Algorithm Definition: A well-defined procedure that allows a computer to solve a problem. Think of it as a recipe for computers! πŸ’‘ Algorithm Representation: Algorithms can be expressed in natural language, pseudocode, flowcharts, or programming languages. πŸ“ Control Structures: These determine the flow of execution in an algorithm. Key structures include:
      🧱 Sequence: Instructions executed in order. 🌿 Selection (if/else): Allows different paths based on conditions. πŸ”„ Iteration (loops): Repeats a block of code.
    βž• Algorithm Efficiency: How much time and memory an algorithm requires. Often described using Big O notation (e.g., $O(n)$, $O(log n)$). 🐞 Algorithm Correctness: An algorithm is correct if it produces the desired output for all valid inputs. βš™οΈ Searching Algorithms:
      🎯 Linear Search: Checks each element sequentially ($O(n)$). 🌳 Binary Search: Requires a sorted list and divides the search space in half with each step ($O(log n)$).
    πŸ“Š Sorting Algorithms:
      ✨ Bubble Sort: Repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order ($O(n^2)$). ⚑ Selection Sort: Divides the input list into two parts: a sorted sublist and an unsorted sublist. It repeatedly selects the smallest (or largest) element from the unsorted sublist and moves it to the sorted sublist ($O(n^2)$).

πŸ§ͺ Practice Quiz

  1. Which of the following is the best definition of an algorithm?
    1. A computer program that solves a problem.
    2. A step-by-step procedure for solving a problem.
    3. A hardware component used in computers.
    4. A type of data storage.
  2. Which control structure allows a program to execute different code blocks based on a condition?
    1. Sequence
    2. Iteration
    3. Selection
    4. Recursion
  3. What is the time complexity of linear search in the worst-case scenario?
    1. $O(1)$
    2. $O(log n)$
    3. $O(n)$
    4. $O(n^2)$
  4. Which searching algorithm requires the list to be sorted?
    1. Linear Search
    2. Bubble Sort
    3. Selection Sort
    4. Binary Search
  5. Which sorting algorithm repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order?
    1. Merge Sort
    2. Quick Sort
    3. Bubble Sort
    4. Insertion Sort
  6. An algorithm is considered correct if it:
    1. Runs quickly.
    2. Uses minimal memory.
    3. Produces the desired output for all valid inputs.
    4. Is easy to understand.
  7. What is the time complexity of Bubble Sort in the worst-case scenario?
    1. $O(n)$
    2. $O(log n)$
    3. $O(n log n)$
    4. $O(n^2)$
Click to see Answers
  1. B
  2. C
  3. C
  4. D
  5. C
  6. C
  7. D

Join the discussion

Please log in to post your answer.

Log In

Earn 2 Points for answering. If your answer is selected as the best, you'll get +20 Points! πŸš€