▲ Camp45
Sign inTry free for 7 days

Computer Science · Theme B: Computational thinking and problem-solving

B2.1 — Programming fundamentals

Computer Science · SL / HL · syllabus-mapped notes

  1. CS_B2.1.1

    Variables, data types and scope

    Constructing and tracing programs with global and local variables of the five data types.

    Full note — free

    A variable is a named store for a value. You must be able to construct programs using variables and to trace them (follow each value by hand). The syllabus names five data types . The five data types Boolean value : True or False. char : a single character, for example 'A'. integer : a whole number, for example 42. decimal : a number with a fractional part, for example 3.14 (a float). string : a sequence of characters, for example "hello". Scope: global versus local A global variable is declared outside all functions and is visible everywhere. A local variable is declared inside a function and exists only while that function runs. e.g. rate = 0.2 # global (decimal) def net(pay): # pay is local (integer) tax = pay * rate # tax is local (decimal) return pay - tax print(net(100)) # 80.0 Tracing means writing a trace table: one column per variable, one row each time a value changes, so you can predict the output. Do not confuse declaring a variable inside a function (local) with reassigning a global. In Python, changing a global from inside a function needs the global keyword; otherwise you create a new local.

  2. CS_B2.1.2

    Extracting and manipulating substrings

    Identifying and extracting substrings, then altering, concatenating or replacing them.

    A substring is part of a larger string. You must be able to construct programs that identify, extract and then manipulate substrings. Identify and extract using slicing / index positions e.g. s = "IB Computer Science" first = s[0:2] # "IB" (extract by slice) i …

    Read the full note free for 7 days →

  3. CS_B2.1.3

    Exception handling techniques

    Points of failure and the try/catch, try/except and finally constructs.

    Exception handling lets a program respond to run-time errors instead of crashing. You must be able to describe how it manages potential points of failure. Points of failure (must include) Unexpected inputs : a user types text where a number is expected. Resource unavailability : …

    Read the full note free for 7 days →

  4. CS_B2.1.4

    Common debugging techniques

    Trace tables, breakpoints, print statements and step-by-step execution.

    Debugging is the process of finding and removing errors. You must be able to construct and use common techniques. (These are illustrative, not a closed set.) Trace tables Record each variable value step by step, by hand, to see exactly where the program deviates from …

    Read the full note free for 7 days →

This topic has 4 full notes in Camp45 — with flashcards, a quiz and Sherpa, the AI tutor, on every one. Try 7 days free →
Sherpa, your Camp45 mountain guide
Hi, I'm Sherpa — your IB mountain guide.
I take you from your material to the syllabus summit. Ask me anything, hand me your essay or your notes — I'll turn it into your system.
💬
Ask me anything
Any of the 26 subjects — I answer from the syllabus.
📝
Essay check
I grade your draft and flag what reads like AI.
📄
Upload your notes
Handout or textbook page → your own syllabus map.
🃏
Flashcards & decks
I turn any topic into a deck you can drill.
3 of 3 free questions — no sign-up.
📝 Check your essay before you hand it in
Sherpa grades it against the IB criteria and flags passages that read like AI — so you can fix them first.

Full notes + a tutor. Every subject, one payment.

Camp45 turns the syllabus into notes that give you exactly what the exam asks — so you study smarter, not harder.

Monthly

€19/mo

All the notes, cancel anytime

Go monthly
Most popular

Full-year access

€149

Every subject, paid once

Get full-year access

Both diploma years

€229

Both years, paid once

Get both years

Syllabus-exact notes

Every understanding statement written out in full — nothing more than the exam asks, nothing left out.

A tutor that answers from the syllabus

Ask anything and it answers from the exact points you are studying.

Every subject, one payment

All 26 IB subjects, SL & HL, covered by a single payment — no per-subject fees.

No credit card. Try the free Biology preview before you commit.