APCSP Computational Thinking Practices 1 — Questions and Answers
Question 1: Which of the following is an example of abstraction in computer science?
- Writing code to solve a specific problem
- Organizing data into a table
- Using a function to perform a complex task without worrying about the implementation details (Correct answer)
- Testing code to find errors
Correct answer: Using a function to perform a complex task without worrying about the implementation details
Abstraction in computer science involves hiding complex implementation details and showing only the essential features. Using a function is a prime example: you call the function by its name, provide inputs, and get an output, without needing to know the intricate steps or code inside the function that produce that output.
Question 2: What is the purpose of an algorithm in computer science?
- To store and organize data
- To provide a step-by-step solution to a problem (Correct answer)
- To execute a program
- To test the efficiency of code
Correct answer: To provide a step-by-step solution to a problem
An algorithm is a precise, unambiguous sequence of instructions or rules designed to solve a specific problem or perform a computation. It outlines the exact step-by-step procedure needed to achieve a desired outcome, forming the logical foundation for computer programs.
Question 3: Which of the following best describes "decomposition" in computational thinking?
- Breaking a problem into smaller, more manageable parts (Correct answer)
- Writing code to manipulate data
- Analyzing the results of a test case
- Creating a function to repeat a task
Correct answer: Breaking a problem into smaller, more manageable parts
Decomposition is a fundamental concept in computational thinking where a complex problem is broken down into smaller, simpler sub-problems. This makes the overall problem easier to understand, analyze, and solve, as each sub-problem can be tackled individually and systematically.
Question 4: A software developer is building a new app that requires the ability to perform calculations. Which of the following is the most effective way to design the app’s calculation feature?
- Manually write out the calculation each time it’s needed
- Use an already-defined function to handle the calculations (Correct answer)
- Create a new function every time a calculation is required
- Store the results of calculations in a database for later use
Correct answer: Use an already-defined function to handle the calculations
Using an already-defined function promotes efficiency, reusability, and abstraction in software development. It avoids redundant code, reduces the chance of errors, and allows the developer to focus on higher-level logic rather than re-implementing basic functionalities like calculations from scratch.
Question 5: Which of the following is an example of pattern recognition in computational thinking?
- Identifying a recurring sequence of numbers in data (Correct answer)
- Using a for loop to repeat a task
- Writing a recursive function
- Storing a large set of data in an array
Correct answer: Identifying a recurring sequence of numbers in data
Pattern recognition in computational thinking involves identifying similarities, trends, or recurring themes within data. Recognizing a recurring sequence of numbers directly exemplifies this by finding predictable structures or regularities in a dataset. This process is crucial for simplifying problems, making predictions, and developing efficient algorithms.
Which of the following is an example of abstraction in computer science?