

































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 1
Correct Answer: Diamond Rationale: In flowcharts, a diamond shape represents a decision or branching point where the flow can go in different directions based on a condition. Ovals represent start/end, rectangles represent processes, and parallelograms represent input/output.
C) To describe the steps of the algorithm D) To determine the programming language used Correct Answer: To provide data that the algorithm processes to produce output Rationale: Input provides the data that an algorithm processes to produce output. It is a key property of algorithms. It does not store final results, describe steps, or determine programming language.
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.
A) A rectangle B) A diamond C) A parallelogram D) An oval Correct Answer: A rectangle Rationale: In flowcharts, a rectangle represents a process or action step. A diamond represents a decision, a parallelogram represents input/output, and an oval represents start/end points. Standardized symbols make flowcharts universally understandable.
Correct Answer: To organize and store data for efficient access and modification Rationale: A data structure defines the way data is organized and stored so it can be efficiently accessed and modified. It influences how well a computational solution performs. Displaying output, connecting to the internet, and compiling code are separate concerns.
Correct Answer: Graph Rationale: A graph is a data structure consisting of nodes (vertices) connected by edges, used to model relationships and networks. Arrays, stacks, and queues are linear data structures with different organizational principles.
B) The topmost node C) A node with exactly one child D) A node connected to all other nodes Correct Answer: A node with no children Rationale: A leaf node is a node in a tree that has no children. The root is the topmost node, and internal nodes have at least one child. Leaf nodes represent the endpoints of the tree's branches.
C) A data structure that stores key-value pairs D) A function that returns a value Correct Answer: A control structure that executes different code based on a condition Rationale: A conditional statement, such as if-else, evaluates a condition and executes different code blocks depending on whether the condition is true or false. Loops repeat code, dictionaries store key-value pairs, and functions encapsulate reusable logic.
Rationale: A while loop checks a condition before each iteration and continues executing as long as the condition is true. A for loop is typically used for a fixed number of iterations. Functions and constants are separate concepts.
Rationale: The return statement ends the function's execution and optionally passes a value back to the code that called it. Printing, variable declaration, and loops are separate operations. A function without a return statement may return None or void.
B) remove C) insert D) delete Correct Answer: append Rationale: The append method adds an element to the end of a list. Remove deletes an element, insert adds at a specific position, and delete removes an element or the entire list. Append is commonly used to build lists dynamically.