In algorithm design, the instruction “If it is raining, then take an umbrella to work” exemplifies which fundamental control structure?

Difficulty: Easy

Correct Answer: Selection

Explanation:


Introduction / Context:
Structured programming builds all algorithms from three fundamental control structures: sequence (do steps in order), selection (choose among alternatives based on a condition), and repetition (loop while a condition holds). Recognizing which structure a statement represents is essential to mapping real-world logic into implementable code and pseudocode.


Given Data / Assumptions:

  • The statement has a condition (“it is raining”).
  • There is a consequent action (“take an umbrella to work”).
  • No loop or multiple sequential steps are implied beyond the conditional choice.


Concept / Approach:
A selection structure evaluates a Boolean condition and chooses a path accordingly (IF…THEN…, IF…ELSE…, or multi-branch). The umbrella example maps directly: if the predicate is true, execute the action; otherwise, skip it. Sequence would apply if we always took the umbrella regardless of weather; repetition would apply if we repeatedly checked a condition over a range or time; “switching” is a colloquial term but in structured design the canonical name is selection.


Step-by-Step Solution:
Identify the explicit condition.Determine whether branching (not looping) is required.Map to the formal term “selection.”


Verification / Alternative check:
In pseudocode: IF raining THEN umbrella := take. This is the textbook form of a selection statement.


Why Other Options Are Wrong:
Control: too vague; all structures control execution.Repetition: would imply loops (while/for).Sequence: implies unconditional execution.Switching: informal; the structured term is selection.


Common Pitfalls:
Confusing selection with repetition when a condition is checked periodically; or writing complex nested selections instead of using guard clauses or tables for clarity.


Final Answer:
Selection

More Questions from System Analysis and Design

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion