B2.3 Programming constructsB2.3.2

Selection structures

Construct programs utilizing appropriate selection structures

SL + HL≈ 60 minCommand term: ConstructPremium

In this lesson

  • Writing if, if–else and else-if (elif) chains, nested selection and switch/match statements
  • Using comparison operators, including comparing strings in Java and Python
  • Combining conditions with AND, OR and NOT
  • Choosing the order of conditions and testing the boundaries

This lesson is part of Premium

Every topic has one free lesson. Premium unlocks every interactive lesson, the exam-style questions at the end of each one, and the rest of Praxis IB.

What's inside

  1. LearnMaking decisions
  2. CodeAn else-if chain
  3. LearnComparison and logical operators
  4. CodeCombining conditions
  5. CodeComparing strings
  6. LabTicket prices
  7. CodeNested selection
  8. Codeswitch (Java) and match (Python)
  9. CheckTrue or false?
  10. CheckQuick check
  11. CodeTry it: a password rule
  12. ExamWorked exam answer
  13. ReviewMistakes examiners see
  14. Exam practiceExam-style questions

Ends with 4 exam-style questions worth 13 marks, with a self-marking markscheme.