Single Choice Moderate

QIn if-else, else runs when if condition is:

ID: #25857 MCQ Quiz - Class 8 - Programming 6 views
Question Info
#25857Q ID
ModerateDifficulty
MCQ Quiz - Class 8 - ProgrammingTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A false
  • B true
  • C empty
  • D invalid
Correct Answer

Explanation

Correct Answer Explanation:

else runs ONLY when the if condition is false. If true, the if block runs and else is skipped.

Why the other options are incorrect:

  • Option B: When true, the if block runs, not else.
  • Option C: 'Empty' isn't a valid condition state.
  • Option D: Java conditions must be valid booleans.

Share This Question

Challenge a friend or share with your study group.