True or false: An algorithm must eventually stop after a finite sequence of steps.
2 Algorithms and Solution Design Online Quiz Questions
Use this free practice quiz with 20 questions to review 2 Algorithms and Solution Design, test your knowledge, and prepare for your next test or exam.
Which flowchart symbol should represent the question “Is purchaseAmount at least 100?”
- A
A rectangle
- B
A diamond
- C
A parallelogram
- D
An oval or rounded rectangle
What computational-thinking technique divides a complex task into smaller subproblems?
Complete the specification: The information supplied to an algorithm is its , and the result it produces is its .
An algorithm repeatedly displays the values 1 through 5 by executing a loop. Which basic control structure is being used?
- A
Iteration
- B
Selection
- C
Sequence
- D
Validation
True or false: In the discount algorithm, the loop that rejects negative purchase amounts is an example of input validation rather than normal result processing.
- A
True
- B
False
Which test inputs would directly test the discount threshold or the nonnegative-input validation rule? Select all correct choices.
- A
99.99
- B
100
- C
-5
- D
80
Using the stated discount rule, what final price results from a purchase amount of 150 dollars? Enter the value in dollars.
Complete the pseudocode keyword: purchaseAmount >= 100 THEN begins the conditional that chooses whether to apply the discount.
A dry run uses purchaseAmount = 120. What output format is required after applying the discount and rounding the monetary result as specified?
- A
$108
- B
$108.0
- C
$108.00
- D
$108.000
Which properties are explicitly expected of a well-designed algorithm? Select all correct choices.
- A
Correct for every valid input
- B
Unambiguous
- C
Visually colorful
- D
Testable
Design a language-independent algorithm for the store discount problem. It must accept a nonnegative purchase amount, apply a 10% discount only when the amount is at least 100, reject negative input through re-entry, and display the final price rounded to two decimal places. Describe the steps in pseudocode or precise ordered prose.
Which statement best describes an assumption in an algorithmic problem specification?
- A
A result produced after the algorithm finishes
- B
An accepted condition that the problem does not otherwise specify
- C
A symbol used only for output in a flowchart
- D
A test value chosen only because it is invalid
True or false: In a flowchart, a diamond represents a decision or condition.
- A
True
- B
False
Which basic control structure should you use when an algorithm must repeat a group of instructions while or until a condition is satisfied?
A program must reject negative purchase amounts and ask for another value before calculating a price. Which step is input validation?
- A
Calculate the final price for a valid purchase amount.
- B
Check whether the purchase amount satisfies the nonnegative constraint.
- C
Apply the discount to every purchase amount.
- D
Round the final price to two decimal places.
Using the discount rule described in the material, what is the final price for a valid purchase amount of 150 dollars? Enter the numeric value to the nearest cent.
An algorithm gives a discount when a purchase amount is at least 100. Which test set most directly checks the boundary and the behavior on both sides of it?
- A
80, 150, and 200
- B
0, 50, and 75
- C
99.99, 100, and 100.01
- D
-5, -1, and 0
A flowchart must show the step that displays the calculated final price. Which symbol should represent that input or output action?
- A
Parallelogram
- B
Rectangle
- C
Diamond
- D
Oval or rounded rectangle
Which specification best describes a general solution for the store discount problem?
- A
Apply the discount only to purchase amounts greater than 100.
- B
Calculate a result only when the purchase amount is exactly 100.
- C
Reject every purchase amount below 100 as invalid.
- D
For every nonnegative amount, apply the discount at or above 100 and otherwise leave the amount unchanged.
Related study packs and tools
02 — Information and Representation
A progressive guide to how computers encode numbers, text, images, and sound as binary data, including the trade-offs and limits of digital representation.
2 Digital Logic
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
03 — Python Programming Fundamentals
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
05 — Data Structures: Concepts, Operations, and Trade-Offs
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
6 Computer Memory
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
07 Trees and Binary Search Trees
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
08 — Discrete Mathematics for Computer Science
A focused review of propositional logic, quantifiers, sets, relations, functions, and foundational proof methods in discrete mathematics for computer science.
10 — Data, Systems, and Applications
A progression through how data is organized, searched, exposed through software interfaces, and managed through abstraction layers in modern computer systems.
12 — Foundations Capstone
A medium-difficulty quiz on integrating problem definition, representation, algorithms, complexity analysis, testing, correctness, ethical evaluation, and documentation in a computer science capstone.
12 — Foundations Capstone: Integrating Computer Science
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
OS Processes
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.