Bird
0
0

Which keyword is used to execute code when all previous if and elif conditions fail?

easy🧠 Conceptual Q2 of 15
Bash Scripting - Conditionals
Which keyword is used to execute code when all previous if and elif conditions fail?
Aelif
Bthen
Cfi
Delse
Step-by-Step Solution
Solution:
  1. Step 1: Identify the role of else

    The else block runs when none of the if or elif conditions are true.
  2. Step 2: Differentiate from other keywords

    elif checks another condition, fi ends the block, and then starts the block after condition.
  3. Final Answer:

    else -> Option D
  4. Quick Check:

    Default fallback = D [OK]
Quick Trick: Use else for fallback when no conditions match [OK]
Common Mistakes:
MISTAKES
  • Using elif instead of else for fallback
  • Forgetting else block
  • Misplacing fi keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes