The instruction “If it’s raining outside, then take an umbrella to work” is an example of the _____ structure

control
repetition
selection
sequence E. switching

The correct answer is C. selection.

A selection structure is a type of control flow structure that allows a program to choose between two or more possible courses of action. In the instruction “If it’s raining outside, then take an umbrella to work”, the program is choosing between two possible courses of action: taking an umbrella or not taking an umbrella. The decision of which course of action to take is based on the condition “if it’s raining outside”.

The other options are not correct.

  • Control is a general term that refers to the flow of control in a program. It does not specifically refer to any particular type of control flow structure.
  • Repetition is a type of control flow structure that allows a program to repeat a block of code a specified number of times or until a certain condition is met.
  • Sequence is a type of control flow structure that allows a program to execute a block of code one after the other.
  • Switching is a type of control flow structure that allows a program to choose between two or more possible courses of action based on the value of a variable.
Exit mobile version