Which of the following is not a requirement or good practice in structured design of programs?
-
AOrganize the program as a hierarchy of modules
-
BUse many GOTO statements within modules
-
CExecute each module in a clear top to bottom flow
-
DKeep modules as independent as possible except for defined parent child links
-
EAim for high cohesion within modules
Answer
Correct Answer: Use many GOTO statements within modules
Explanation
Introduction / Context:Structured design promotes readable, maintainable programs through clear control structures and modular decomposition. Unrestricted jumps using GOTO contradict these principles and increase complexity.
Given Data / Assumptions:
- Goal is maintainable code with predictable control flow.
- Modules should have single responsibilities and minimal coupling.
- Control constructs such as sequence, selection, and iteration are preferred.
Concept / Approach:Structured programming avoids arbitrary jumps. Instead, developers use if else, loops, and case constructs to express logic. This reduces cyclomatic complexity and eases testing.
Step-by-Step Solution:
1) List the practices associated with structured design. 2) Identify the practice that conflicts with those principles. 3) Conclude that heavy use of GOTO is not a requirement and is discouraged.Verification / Alternative check:Check authoritative guidelines that emphasize hierarchical modules, top to bottom flow, and limited coupling. None endorse liberal GOTO usage.
Why Other Options Are Wrong:
Hierarchy of modules is foundational to structured design. Top to bottom control within a module supports clarity. Module independence with defined interfaces reduces coupling. High cohesion is a classic quality goal.Common Pitfalls:Believing that occasional structured exits are equivalent to arbitrary jumps is a misunderstanding.
Final Answer:Use many GOTO statements within modules.