asked 187k views
3 votes
When writing a selection construct, the most probable conditions should come before those that occur less frequently.

a) True
b) False

asked
User Qfazille
by
7.9k points

1 Answer

2 votes

Final answer:

True. When writing a selection construct, it is recommended to place the most probable conditions at the beginning.

Step-by-step explanation:

The answer to the question, When writing a selection construct, the most probable conditions should come before those that occur less frequently - True or False, is True.

When writing a selection construct, it is generally a good practice to place the most probable conditions at the beginning, followed by conditions that occur less frequently. By doing so, you increase the efficiency of the program as it will evaluate the most likely conditions first, potentially avoiding unnecessary evaluations of less probable conditions.

For example, in a program that checks the weather conditions and decides whether to bring an umbrella or not, you would typically check for rainy conditions first, as they are more likely to occur than other weather conditions like snow or sunshine.

answered
User Pikkvile
by
8.4k points

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.