Decision structures are also known as selection structures.

T/F. Decision structures are also known as selection structures.

The Correct Answer and Explanation is:

True. Decision structures are indeed also referred to as selection structures in programming and computer science.

Explanation:

In programming, decision structures, or selection structures, are fundamental control flow constructs that allow a program to execute certain parts of code based on specific conditions. The purpose of these structures is to enable a program to make choices and behave differently depending on the input or state of the application.

The most common types of decision structures include:

  1. If Statement: This is the simplest form of a decision structure. It evaluates a condition; if the condition is true, the program executes a specified block of code. For example:
   if temperature > 100:
       print("Boiling point reached.")
  1. If-Else Statement: This structure provides a way to execute one block of code if the condition is true and another block if it is false. This is useful when two distinct paths of execution are needed. For instance:
   if age >= 18:
       print("You are an adult.")
   else:
       print("You are a minor.")
  1. Else If (or Elif) Statement: This extends the if-else structure to allow multiple conditions to be evaluated in sequence. Each condition is checked until a true condition is found, and the corresponding block of code is executed. For example:
   if score >= 90:
       print("Grade: A")
   elif score >= 80:
       print("Grade: B")
   else:
       print("Grade: C")
  1. Switch Statement: While not available in all programming languages, a switch statement allows multiple possible execution paths based on the value of a variable. It is typically more efficient than using multiple if-else statements.

In summary, decision structures or selection structures are crucial in programming because they provide the capability to direct the flow of execution based on conditions, making programs dynamic and responsive to different inputs or states. This allows developers to implement complex logic and create applications that can adapt to various scenarios.

Scroll to Top