Question Bank (2 marks) · Q30
Q.For what purpose if -statement and if-else statements are used?
Karnataka PUCTextbookShort· 2mImportance★★★★★est
90% · 138/154 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →[!TLDR]
if runs a block when a condition is true; if-else chooses between a true block and a false block.
Both statements make decisions based on a condition:
- The if statement tests a condition and executes its block of statements only if the condition is true; if false, control simply skips to the next statement.
- The if-else statement provides two blocks: the first runs when the condition is true and the second (the else block) runs when it is false, so exactly one of the two is always executed.
if (marks >= 35) …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.