Save
OCR A-Level Computer Science
2.2 Problem-solving and programming
2.2.4 Structured programming
Save
Share
Learn
Content
Leaderboard
Share
Learn
Cards (44)
In structured programming, flow control uses sequence, selection, and
iteration
Structured programming simplifies program structure by eliminating the need for
goto
Structured programming improves code readability by using logical control structures like loops and
if-else
Structured programming results in code with high
readability
Maintainability in structured programming is enhanced by clear
modularity
.
True
The use of `goto` statements can lead to complex, difficult-to-follow program
logic
Match the control structure with its description.
Sequence ↔️ Default flow of execution
Selection ↔️ Executes different code paths based on conditions
Iteration ↔️ Repeats a block of code
What is an example of iteration in structured programming?
for loop
Order the steps in decomposing the `calculate_total_cost` function into smaller functions.
1️⃣ Calculate subtotal
2️⃣ Calculate tax
3️⃣ Calculate total
What is a key feature of unstructured programming that structured programming avoids?
goto statements
The use of `goto` statements can lead to complex, difficult-to-follow program
logic
What is an example of a sequence control structure?
x = 5; y = 10; z = x + y;</latex>
What is an example of an iteration control structure?
for (let i = 0; i < 5; i++) { ... }</latex>
Which approach has higher readability, function decomposition or a monolithic approach?
Function Decomposition
Which control structure enables decision-making in structured programming?
Selection
What is structured programming defined as?
A programming methodology
Why is debugging easier in structured programming?
Modular code blocks
What are the three primary control structures in structured programming?
Sequence, selection, iteration
What is the main goal of structured programming regarding program flow?
Avoid goto statements
The selection control structure uses
if-else
The three basic control structures in structured programming are sequence,
selection
, and iteration.
True
Function decomposition reduces code
complexity
In structured programming, flow control relies on sequence, selection, and
iteration
.
The basic control structures in structured programming control the flow of execution in a program.
True
Match the control structure with its description:
Sequence ↔️ Statements are executed in order
Selection ↔️ Executes different code paths based on conditions
Iteration ↔️ Repeats a block of code multiple times
The `if-else` statement is used in structured programming for
selection
Steps to decompose the 'calculate_total_cost' function
1️⃣ Calculate subtotal
2️⃣ Calculate tax
3️⃣ Calculate total
Modularity allows modules to be reused in different parts of the
application
Sequence
executes statements in the order they appear.
True
Structured programming enhances code readability compared to unstructured programming.
True
Match the feature with the corresponding programming style:
Flow Control ↔️ Sequence, Selection, Iteration
Readability ↔️ High
Goto Statements ↔️ Unstructured Programming
Structured programming reduces complexity by eliminating
goto statements
.
True
Match the control structure with its description:
Sequence ↔️ Statements executed in order
Selection ↔️ Choice based on condition
Iteration ↔️ Repeated execution of code
What is the purpose of the sequence control structure in structured programming?
Execute statements in order
Order the basic control structures used in structured programming.
1️⃣ Sequence
2️⃣ Selection (if-else)
3️⃣ Iteration (for, while)
In structured programming, an example of selection is the
if-else
statement.
Function decomposition enhances code readability, reusability, and maintainability.
True
Structured programming avoids the use of `goto` statements to control program flow.
True
Match the benefit of structured programming with its example.
Reduced Complexity ↔️ Replacing `goto` statements with `if` and `while` constructs
Readability ↔️ Using loops and `if-else` statements instead of `goto`
Maintainability ↔️ Modifying a specific function without affecting others
The basic control structures in structured programming are sequence, selection, and
iteration
.
True
See all 44 cards