Forty5
EN
Download the app Open the app

IB Diploma · Formulas

IB Computer Science formula sheet

All 15 formulas from Forty5’s IB Computer Science SL and HL course, grouped by unit. The code after each one is its place in the syllabus, and the 3 formulas marked HL are for the HL course only.

Using formulas in the exam

  • Know what you are given. Some subjects hand out a formula or data booklet in the exam. Ask your teacher which formulas are in it and which you must learn by heart.
  • Know every symbol. A formula only helps if you know what each letter means and which unit it takes.
  • Write it before you use it. Writing the formula, then the numbers, earns method marks even if the final answer slips.

Data representation

Binary to denary
denary = sum of the place values (128, 64, 32, 16, 8, 4, 2, 1) where the bit is 1Fundamentals
Hexadecimal to denary
denary = first digit × 16 + second digit (A = 10 … F = 15)Fundamentals
Values from n bits
number of values = 2ⁿFundamentals
Image file size
size (bits) = width × height × colour depth; bytes = bits / 8Fundamentals
Compression ratio
compression ratio = original size / compressed sizeFundamentals
Pipelined cycles HL
cycles = number of stages + (number of instructions − 1)Fundamentals

Networks and security

Transfer time
time (s) = file size (bits) / bandwidth (bits per second)Networks
Possible passwords
combinations = (number of possible characters)lengthNetworks

Algorithms and data

Integer division and modulus
a = (a // b) × b + (a % b)Programming
Bubble sort comparisons (worst case)
comparisons = n(n − 1) / 2Programming
Halving steps
halvings = log₂ nProgramming
Scaling an O(n²) time
new time = old time × (new n / old n)²Programming
Hash index HL
index = key % table sizeData structures

Machine learning

Accuracy
accuracy (%) = correct predictions / total predictions × 100Machine learning
Min–max normalisation HL
x′ = (x − min) / (max − min)Machine learning

From the Forty5 Computer Science course, which follows the current IB guide. Check the official formula or data booklet for your exam with your teacher. Forty5 is not affiliated with or endorsed by the International Baccalaureate Organization.

Practise using them.

In Forty5 every formula comes with five-minute lessons, worked examples and exam-style questions. The first unit of Computer Science is free.

Open Forty5

More for IB Computer Science

Official IB information

For the rules and the current subject guides, check the IB’s own pages: