

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


































CS 120 Computational Thinking module 4
D) Loop Correct Answer: Variable Rationale: A variable is a named storage location whose value can change during program execution. A constant holds a fixed value, a function is a reusable block of code, and a loop is a control structure that repeats instructions.
A) Integer B) Boolean C) Floating-point D) String Correct Answer: Floating-point Rationale: A GPA typically includes a decimal component (e.g., 3.75), so a floating- point data type is appropriate. Integers store whole numbers, Booleans store true/false, and strings store text.
Rationale: A map that shows only major roads and cities abstracts away minor streets and unnecessary details, making navigation easier. Following a recipe is an algorithm, sorting is an algorithm, and repeating a task is iteration.
Correct Answer: Abstraction simplifies problems by focusing on essential features Rationale: Abstraction is a problem-solving technique that reduces complexity by concentrating on the most important aspects of a problem. It does not make problems harder, eliminate algorithms, or apply only to hardware.
A) A sequence of characters enclosed in quotation marks B) A numeric value with a decimal point C) A true or false value D) A type of loop Correct Answer: A sequence of characters enclosed in quotation marks Rationale: A string is a data type that represents text—a sequence of characters (letters, digits, symbols) enclosed in quotation marks. Numeric values, Booleans, and loops are different concepts.
Correct Answer: Using a function to perform a specific task without knowing its internal implementation Rationale: Procedural abstraction allows programmers to use functions as "black boxes"—they know what the function does but not necessarily how it does it. Storing data, writing loops, and declaring variables are separate concepts.
Correct Answer: An error may occur if the program attempts to modify the constant's value Rationale: Constants cannot be modified. If a program tries to assign a new value to a constant, an error will occur (depending on the language, either at compile time or runtime). Constants do not automatically become variables.
Rationale: Pseudocode allows programmers to plan and communicate algorithms using plain language and structural conventions without worrying about the syntax of a specific programming language. It is not executable, does not store data, and does not encrypt code.
Correct Answer: A parameter is a variable in a function definition; an argument is the value passed to it Rationale: A parameter is a variable listed in a function definition that receives a value. An argument is the actual value passed into the function when it is called. They are related but distinct concepts.
Correct Answer: Last-In, First-Out (LIFO) Rationale: A stack follows the LIFO principle, meaning the most recently added element is the first one removed. Queues follow FIFO, arrays allow random access by index, and linked lists use pointers.