Bird
0
0

What does an if-else statement do in C?

easy📝 Conceptual Q11 of 15
C - onditional Statements
What does an if-else statement do in C?
AIt declares a variable.
BIt repeats a block of code multiple times.
CIt defines a new function.
DIt chooses between two actions based on a condition.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of if-else

    An if-else statement lets the program pick one of two paths depending on whether a condition is true or false.
  2. Step 2: Match the description to the options

    Only It chooses between two actions based on a condition. describes choosing between two actions based on a condition, which is exactly what if-else does.
  3. Final Answer:

    It chooses between two actions based on a condition. -> Option D
  4. Quick Check:

    If-else = choose between two paths [OK]
Quick Trick: If you want two choices, use if-else [OK]
Common Mistakes:
  • Confusing if-else with loops
  • Thinking if-else declares variables
  • Mixing if-else with function definitions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes