aimnova.
DashboardMy LearningPaper MasteryStudy Plan

Aimnova site navigation

Stay in the loop

Get the latest study resources and updates

New features, study tips and exam insights — straight to your inbox.

IB Diploma

  • IB Past Papers
  • IB Study Notes
  • IB Question Bank
  • IB Mock Exams
  • IB Revision

IB Subjects

  • IB Math AA
  • IB Math AI
  • IB Economics
  • IB Business Management
  • IB Physics
  • IB Biology
  • View all IB subjects→

IB Past Papers

  • IB Math AA HL Past Papers
  • IB Math AA SL Past Papers
  • IB Math AI HL Past Papers
  • IB Math AI SL Past Papers
  • IB Economics HL Past Papers
  • IB Economics SL Past Papers
  • IB ESS Past Papers
  • View all past papers→

Study Resources

  • Study Notes
  • Question Bank
  • Mock Exams
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aimnova.

AI-powered study platform for smarter revision, past-paper analysis and examiner-style feedback.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.8afc4e3

Aimnova is not affiliated with or endorsed by the International Baccalaureate Organization (IB).

NotesComputer ScienceTopic 6.1
Unit 6 · Programming · Topic 6.1

IB Computer Science — Programming fundamentals

Programming fundamentals

Exam technique guidePractice questions

Key concepts in Programming fundamentals

Key Idea: A program's data lives in variables of a declared type, and things go wrong at run time whatever the code says. So handling failure is part of writing the program, not something added afterwards.

Paper 1

  • Short definitions and a trace.
  • State, identify, outline — precise terms.

Paper 2

  • Write or correct Python for a scenario — your paper is the Python version, option B.
  • Construct, determine, suggest.

Both

  • Trace tables and justified choices earn method marks even when the final answer slips.

🏷️ Choosing a data type

DataTypeWhy
A count of itemsIntegerWhole, and used in arithmetic
A priceDecimalExact to the penny — floating point is not
A phone numberStringNever added; leading zeros matter
Paid or unpaidBooleanTwo states — text invites 'Y', 'y' and 'true' as well
Is this value ever used in arithmetic? If not, it is text however many digits it has. Concatenating '5' and '3' gives '53'; adding 5 and 3 gives 8.
Important: Floating point stores values in binary, and 0.1 has no exact binary form. Additions accumulate a tiny error, so a total ends at 9.999999 instead of 10.00 — and a comparison with 10.00 then fails.

🌐 Scope

Local beats global

  • A local variable exists only inside its function — a wrong value has one place to come from
  • A global can be changed anywhere, so two parts of the program interfere invisibly
  • A constant is fixed at declaration; the compiler rejects any change to it
  • Pass values in as parameters and return results — then each function can be tested alone

🐞 The three kinds of error

KindWhen it appearsWhy it matters
SyntaxBefore anything runsHarmless — it is reported and cannot be ignored
Run-timeOn some inputs, perhaps rarelyCrashes; may survive testing
LogicNever reportedThe dangerous one — a wrong answer that is simply used

🛡️ Exception handling

Doing it properly

  • Code that might fail goes in a TRY block; failure jumps to CATCH and the program continues
  • An empty catch is worse than no catch — it turns a visible failure into a silent corruption
  • A catch should log the details, tell the user something actionable, and recover or stop cleanly
  • Validate what you can predict; catch what you cannot, such as a file disappearing mid-read
  • The log entry and the user's message have different audiences and should differ

📝 Exam-style questions

IB-style questionSuggest[4 marks]

A booking form reads a date of birth typed by the user. Suggest how the program should handle input that is not a valid date, and explain why a TRY/CATCH block alone is not enough.

🔒 Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic →
IB-style questionExplain[3 marks]

A program stores a total as a decimal. A colleague suggests changing it to a floating-point number to save memory. Explain why this is a poor decision.

🔒 Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic →

✅ Quick check

Cover the answers.

Which error type is never reported? A logic error — the program runs to completion and gives a wrong answer.

Why is a phone number a string? It is never used in arithmetic, and leading zeros would be lost if stored as a number.

Why is an empty CATCH block dangerous? It converts a visible failure into silent corruption — the program continues with data it knows is wrong.

What is casting? Converting a value from one type to another — such as input text to an integer. It fails if the text is not numeric.

Why prefer a local variable? A wrong value has one place to come from; a global can be changed anywhere in the program.


Exam tips

  • Ask whether the value is used in arithmetic — that decides the type in one step.
  • Money is decimal, never floating point. Say why: binary cannot hold 0.1 exactly.
  • Name all three error types and say which one is dangerous, and why.
  • Validation prevents predictable faults; exception handling contains unpredictable ones.
  • Never leave a catch block empty — say what should be logged and what the user should see.
  • Check whether a question indexes strings from 0 or from 1 before extracting anything.

What you'll learn in Topic 6.1

  • 6.1.1 Variables and data types
  • 6.1.2 Substrings
  • 6.1.3 Exception handling
  • 6.1.4 Debugging
Suggested study order: Read the notes for each sub-topic below → test yourself with flashcards → attempt practice questions → review exam technique.

Study resources — 6.1 Programming fundamentals

6.1.1

Variables and data types

Notes
6.1.2

Substrings

Notes
6.1.3

Exception handling

Notes
6.1.4

Debugging

Notes

Ready to study Programming fundamentals?

Get expert practice questions with instant AI feedback, and a study planner tailored to your IB Computer Science exam date.

Start studying free

Topic 6.1 Programming fundamentals forms a core part of Unit 6: Programming in IB Computer Science. Mastering these concepts will strengthen your understanding of connected topics across the syllabus and prepare you for exam questions that require analysis, evaluation, and real-world application.

Previous topic
5.1 Computational thinking
Next topic
6.2 Data structures
All Computer Science topics
Exam technique

Ready to practice?

Get AI-graded practice questions, mock exams, flashcards, and a personalised study plan — all aligned to your IB syllabus.

Start Studying Free

No credit card required · No time limit