Download CS 120 Computational Thinking module 3 and more Exams Computer Science in PDF only on Docsity!
CS 120 Computational Thinking module 3
- Which of the following best describes a sequence in computational thinking? A) A decision point where the flow branches based on a condition B) A set of instructions executed in a specific order, one after another C) A process that repeats a block of code until a condition is met D) A method for storing data permanently in a database Correct Answer: A set of instructions executed in a specific order, one after another Rationale: A sequence is the most basic control structure in computational thinking and programming, where instructions are carried out in the exact order they are written. It provides the foundation for more complex structures like selection and iteration. Branching, looping, and storage are separate concepts.
- What is the primary purpose of abstraction in computational thinking? A) To break a complex problem into smaller sub-problems B) To identify similarities and patterns across different problems C) To simplify a problem by focusing on essential features and ignoring irrelevant details D) To create a step-by-step sequence of instructions for solving a problem Correct Answer: To simplify a problem by focusing on essential features and ignoring irrelevant details Rationale: Abstraction reduces complexity by filtering out unnecessary details and concentrating on the core aspects of a problem. This makes problems easier to understand, solve, and generalize. Decomposition breaks problems down, pattern recognition finds similarities, and algorithm design creates procedures.
- According to the module, which term refers to values that can change within a problem or program? A) Constants B) Variables
C) Inputs D) Outputs Correct Answer: Variables Rationale: Variables are named storage locations whose values can change during program execution. Constants, by contrast, hold fixed values that do not change. Inputs are data entered into a system, and outputs are information presented to the user.
- In the context of computational thinking, what is decomposition? A) Simplifying a problem by removing unnecessary details B) Breaking a complex problem into smaller, more manageable parts C) Identifying repeated structures across different problems D) Creating a visual representation of an algorithm Correct Answer: Breaking a complex problem into smaller, more manageable parts Rationale: Decomposition involves dividing a large or difficult problem into smaller sub-problems that can be solved independently. This makes the overall problem more approachable and allows for focused solutions. Simplifying by removing details is abstraction, identifying repeats is pattern recognition, and visual representation is a flowchart or diagram.
- What is the most likely purpose of a flowchart in computational thinking? A) To execute a program automatically without human intervention B) To provide a visual diagram illustrating the steps and flow of an algorithm C) To store data permanently for later retrieval D) To translate source code into machine code Correct Answer: To provide a visual diagram illustrating the steps and flow of an algorithm
- In the context of the input-process-output-storage model, what does the "process" component refer to? A) The data entered into the system by the user B) The transformation of input data into useful information C) The final result presented to the user D) The permanent retention of data on a storage device Correct Answer: The transformation of input data into useful information Rationale: In the input-process-output-storage model, "process" refers to the operations performed on input data to transform it into meaningful output. Input is the data entered, output is the result presented, and storage is where data is retained permanently.
- Which term refers to a fixed value that does not change during the execution of a program? A) Variable B) Constant C) Input D) Output Correct Answer: Constant Rationale: A constant is a value that remains fixed and does not change throughout a program's execution. Variables can change, inputs are data entered, and outputs are results presented. Constants are useful for representing values like mathematical constants or configuration settings.
- What is the most likely benefit of using abstraction when solving a complex problem? A) It makes the problem more detailed and comprehensive B) It simplifies the problem by focusing on essential elements
C) It breaks the problem into unrelated sub-problems D) It eliminates the need for any further analysis Correct Answer: It simplifies the problem by focusing on essential elements Rationale: Abstraction reduces complexity by concentrating on the core, essential features of a problem while ignoring irrelevant details. This makes the problem easier to understand and solve. It does not make problems more detailed, break them into unrelated parts, or eliminate the need for analysis.
- According to the module, which of the following is a component of computational thinking? A) Decomposition B) Compilation C) Encryption D) Defragmentation Correct Answer: Decomposition Rationale: The four key components of computational thinking are decomposition, pattern recognition, abstraction, and algorithm design. Compilation is a software development process, encryption is a security technique, and defragmentation is a system maintenance task.
- In a flowchart, what does a diamond shape represent? A) A process or action step B) A decision or branching point C) The start or end of an algorithm D) Input or output operations Correct Answer: A decision or branching point
B) The problem is divided into smaller, more manageable sub-problems C) The problem is solved without any planning D) The problem becomes a single indivisible unit Correct Answer: The problem is divided into smaller, more manageable sub- problems Rationale: Decomposition breaks a complex problem into smaller, independent sub- problems that are easier to solve, test, and verify individually. This makes the overall problem more approachable. It does not make the problem more difficult, eliminate planning, or keep it indivisible.
- In the context of computational thinking, what does the term "automation" refer to? A) Writing code manually without any tools B) Using computing technology to carry out tasks with little or no human intervention C) Breaking a problem into smaller parts D) Ignoring unnecessary details in a problem Correct Answer: Using computing technology to carry out tasks with little or no human intervention Rationale: Automation in computational thinking refers to using computing technology to perform tasks automatically, reducing the need for human intervention. It is not about manual coding, decomposition, or abstraction. Automation is a key outcome of designing effective algorithms.
- Which of the following best describes an algorithm? A) A physical device used to input data into a computer B) A finite, ordered sequence of clear instructions for solving a problem C) A type of computer virus that spreads through networks D) A language used exclusively for database queries
Correct Answer: A finite, ordered sequence of clear instructions for solving a problem Rationale: An algorithm is a finite, ordered set of clear instructions designed to accomplish a specific task or solve a problem. It is not a hardware device, malware, or a database-specific language. Algorithms can be expressed in pseudocode, flowcharts, or programming languages.
- What is the primary role of pattern recognition in solving computational problems? A) To break a problem into smaller parts B) To identify similarities and trends that can guide solutions C) To remove all unnecessary details from a problem D) To write the final code for a program Correct Answer: To identify similarities and trends that can guide solutions Rationale: Pattern recognition helps problem solvers identify similarities, trends, and repeated structures across data or problems. This allows for grouping similar cases, predicting outcomes, and reusing solutions. Breaking problems apart is decomposition, removing details is abstraction, and writing code is implementation.
- According to the module, which of the following is NOT one of the four pillars of computational thinking? A) Decomposition B) Pattern recognition C) Compilation D) Algorithm design Correct Answer: Compilation
A) The transformation of data into information B) Data supplied to a program, system, or algorithm C) The final result presented to the user D) The permanent retention of data Correct Answer: Data supplied to a program, system, or algorithm Rationale: In the input-process-output-storage model, "input" refers to the data supplied to a program, system, or algorithm for processing. Process is the transformation, output is the result presented, and storage is where data is retained.
- Which of the following is a key property of a good algorithm? A) It must be ambiguous to allow flexibility B) It must have a finite number of steps and terminate C) It must require the use of recursion D) It must only work for a single specific input Correct Answer: It must have a finite number of steps and terminate Rationale: A good algorithm must be finite, meaning it terminates after a finite number of steps, and must be clear, unambiguous, and effective. Ambiguity, mandatory recursion, and single-input-only designs are not properties of good algorithms.
- What is the most likely outcome of using a loop without a proper termination condition? A) The loop will execute once and stop B) The loop may run indefinitely, causing an infinite loop C) The loop will automatically correct itself D) The loop will skip all iterations
Correct Answer: The loop may run indefinitely, causing an infinite loop Rationale: A loop without a proper termination condition may run indefinitely, causing an infinite loop that never stops. This can freeze the program or consume excessive resources. It will not execute once and stop, self-correct, or skip iterations.
- According to the module, which term refers to a step-by-step procedure for solving a problem or accomplishing a task? A) Algorithm B) Abstraction C) Decomposition D) Pattern recognition Correct Answer: Algorithm Rationale: An algorithm is a step-by-step procedure or set of rules to be followed in calculations or other problem-solving operations. Abstraction simplifies, decomposition breaks problems apart, and pattern recognition identifies similarities. Algorithms are central to computational thinking.
- Which of the following best describes the relationship between computational thinking and programming? A) Computational thinking is only useful for programming B) Programming is a tool used to implement computational thinking solutions C) Computational thinking and programming are unrelated D) Programming is a subset of computational thinking Correct Answer: Programming is a tool used to implement computational thinking solutions Rationale: Computational thinking is a broader problem-solving approach that can be applied across many domains, while programming is a tool used to implement
D) A computer's hard drive Correct Answer: A recipe for baking a cake Rationale: A recipe is a finite, well-defined sequence of steps for achieving a specific outcome (baking a cake), making it an everyday example of an algorithm. A painting, random numbers, and a hard drive are not algorithms.
- What is the most likely benefit of using computational thinking in problem- solving? A) It guarantees that the first solution attempted will always work B) It provides a systematic approach that improves efficiency and reduces errors C) It eliminates the need for testing and verification D) It allows problems to be solved without any planning Correct Answer: It provides a systematic approach that improves efficiency and reduces errors Rationale: Computational thinking offers a structured, systematic approach to problem-solving that helps break down complexity, identify patterns, and design effective solutions. This improves efficiency and reduces errors. It does not guarantee first-attempt success, eliminate testing, or remove the need for planning.
- According to the module, which of the following is a control structure that allows a program to repeat a block of code? A) Selection B) Sequence C) Iteration D) Abstraction Correct Answer: Iteration
Rationale: Iteration is a control structure that allows a program to repeat a block of code multiple times, often through loops such as for and while. Selection makes decisions, sequence executes steps in order, and abstraction simplifies by focusing on essentials.
- What is the primary purpose of a conditional statement in programming? A) To repeat a block of code multiple times B) To make decisions and execute different code based on a condition C) To store data permanently D) To define a function Correct Answer: To make decisions and execute different code based on a condition Rationale: Conditional statements, such as if-else, allow a program to make decisions and execute different blocks of code based on whether a condition is true or false. Loops repeat code, storage handles data, and functions define reusable blocks.
- Which of the following best describes a constant in programming? A) A named storage location whose value can change B) A fixed value that does not change during program execution C) A type of loop that repeats indefinitely D) A function that returns a value Correct Answer: A fixed value that does not change during program execution Rationale: A constant is a value that remains fixed and does not change throughout a program's execution, unlike a variable whose value can change. Constants are useful for representing values that should not be modified, such as mathematical constants or configuration settings.
- In a flowchart, what does an oval shape represent? A) A process or action step
Rationale: Abstraction involves focusing on essential details while ignoring irrelevant ones. A map that shows only major roads and cities abstracts away minor streets and details, making navigation easier. Following a recipe is an algorithm, breaking a project down is decomposition, and noticing traffic patterns is pattern recognition.
- According to the module, which term refers to the data supplied to a program, system, or algorithm? A) Output B) Input C) Process D) Storage Correct Answer: Input Rationale: Input refers to the data supplied to a program, system, or algorithm, such as through a keyboard, sensor, or file. Output is the data produced, process is the transformation, and storage is where data is kept.
- What is the most likely purpose of using a flowchart in algorithm design? A) To execute a program automatically B) To provide a visual representation of the algorithm's steps and flow C) To store data permanently for later retrieval D) To translate source code into machine code Correct Answer: To provide a visual representation of the algorithm's steps and flow Rationale: A flowchart is a graphical representation of an algorithm that uses standardized symbols to show the sequence of steps, decisions, and flow of control. It is a planning and communication tool, not an execution engine, storage device, or translator.
- Which of the following best describes the relationship between an algorithm and a program? A) An algorithm is written in a programming language, while a program is not B) An algorithm is a conceptual sequence of steps, while a program is its implementation in code C) A program is always shorter than an algorithm D) An algorithm can only be expressed visually Correct Answer: An algorithm is a conceptual sequence of steps, while a program is its implementation in code Rationale: An algorithm is a conceptual, language-independent sequence of steps for solving a problem. A program is the implementation of an algorithm in a specific programming language. Algorithms can be expressed in various forms, not just visually, and programs are not necessarily shorter.
- In the context of computational thinking, what does the term "state" refer to? A) The current condition or configuration of a system at a particular moment B) A permanent storage location for data C) A type of programming language D) A visual representation of an algorithm Correct Answer: The current condition or configuration of a system at a particular moment Rationale: State refers to the current condition or configuration of a system at a particular moment. A state transition is a change from one state to another caused by an input, rule, or event. It is not a storage location, language, or diagram.
- Which of the following is a key characteristic of a well-designed algorithm? A) It should be ambiguous to allow creative interpretation B) It should be clear, unambiguous, and finite C) It should require the use of recursion
Rationale: Parallelization involves carrying out multiple tasks or operations simultaneously to solve a problem more efficiently, often using multiple processors or cores. It is not decomposition, abstraction, or pattern recognition, though it may be used alongside them.
- Which of the following best describes a Boolean value? A) A value that can be any integer B) A value that is either true or false C) A value that represents a text string D) A value that represents a decimal number Correct Answer: A value that is either true or false Rationale: A Boolean value is a data type that can hold one of two possible values: true or false. It is used in conditional expressions and logical operations. Integers, strings, and decimals are other data types.
- What is the most likely outcome of using abstraction in a computational solution? A) The solution becomes more complex and detailed B) The solution focuses on essential features and ignores irrelevant details C) The solution is broken into unrelated parts D) The solution eliminates the need for any algorithms Correct Answer: The solution focuses on essential features and ignores irrelevant details Rationale: Abstraction simplifies a problem or solution by concentrating on the essential features while ignoring irrelevant details. This makes the solution easier to understand and implement. It does not make the solution more complex, break it into unrelated parts, or eliminate the need for algorithms.
- According to the module, which of the following is an example of a control structure that allows a program to make decisions?
A) Sequence B) Iteration C) Selection D) Abstraction Correct Answer: Selection Rationale: Selection is a control structure that allows a program to make decisions and choose different paths of execution based on a condition. Sequence executes steps in order, iteration repeats code, and abstraction is a computational thinking skill.
- What is the primary purpose of a for loop? A) To execute a block of code as long as a condition is true B) To execute a block of code a specified number of times C) To define a function D) To declare a variable Correct Answer: To execute a block of code a specified number of times Rationale: A for loop is typically used to execute a block of code a specific number of times, often iterating over a range or collection. A while loop executes as long as a condition is true. Functions and variables are separate concepts.
- In the context of the input-process-output-storage model, what does the "storage" component refer to? A) The transformation of data into information B) Data supplied to a program C) The final result presented to the user D) The permanent retention of data on a storage device Correct Answer: The permanent retention of data on a storage device