In a selection structure, the structure-controlling question is

In a selection structure, the structure-controlling question is.

a. asked once at the beginning of the structure
b. asked once at the end of the structure
c. asked repeatedly until it is false
d. asked repeatedly until it is true

The correct answer and explanation is :

The correct answer is:

a. asked once at the beginning of the structure.

Explanation:

A selection structure, also known as a decision structure, is a fundamental concept in programming that allows a program to make choices based on certain conditions. These structures enable a program to execute different sets of instructions depending on whether a specified condition evaluates to true or false.

Selection structures are commonly implemented using conditional statements such as if, if-else, and switch statements in programming languages like Python, Java, and C++. These statements help control the flow of execution by determining which block of code should run.

Why is the correct answer (a)?

In a selection structure, the decision-making condition (or structure-controlling question) is evaluated once at the beginning of the structure. If the condition evaluates to true, one set of instructions is executed. If it evaluates to false, a different set of instructions (or none at all) may execute. This is characteristic of if-else statements.

Here, the condition age >= 18 is evaluated once at the beginning. If the condition is true, the first block of code runs. If it is false, the second block executes.

Why are the other options incorrect?

  • (b) asked once at the end – This describes a looping structure with a do-while loop, not a selection structure.
  • (c) asked repeatedly until false – This is characteristic of a while loop, not a selection structure.
  • (d) asked repeatedly until true – This also represents a looping structure, such as a while or do-while loop, not a selection structure.

Thus, in a selection structure, the condition is evaluated once at the beginning, making option (a) the correct choice.

Scroll to Top