Aller au contenu
Examens 2027-2028 : Places DisponiblesPostuler
ITMagicITMagicAcademy
Ressources AP
APInformatiqueCSP

Binary & Data Representation

AP Computer Science Principles — bits and bytes, converting between binary and decimal, and how numbers, text and images are represented digitally. Worked example and exam tip.

Everything a computer stores — numbers, text, images, sound — is ultimately binary: sequences of 0s and 1s. Understanding this "Data" big idea is central to AP Computer Science Principles (CSP).

Bits and bytes

  • A bit is a single 0 or 1.
  • A byte is 8 bits and can represent 2⁸ = 256 different values (0–255).
  • With n bits you can represent 2ⁿ distinct values.

Binary → decimal

Each place is a power of 2 (…, 8, 4, 2, 1):

1011₂ = 8 + 0 + 2 + 1 = 11₁₀

Decimal → binary

Subtract the largest fitting power of 2:

13 = 8 + 4 + 1 → 1101₂

Representing other data

  • Text: each character maps to a number (e.g. ASCII: 'A' = 65), then to binary.
  • Images: a grid of pixels; each pixel's colour is stored as RGB numbers (0–255 each).
  • Because storage is finite, large or precise values cause overflow (too big to store) or round-off (lost precision) errors.

Worked example

How many values can 4 bits represent, and what is the largest?

2⁴ = 16 values, from 0 to 15 (1111₂).

Exam tip

CSP tests concepts and abstraction, not heavy math. Know that more bits → more values (and more storage), why analog data must be sampled to become digital, and the difference between lossless and lossy compression. You will not need long hand-conversions under time pressure — you need the reasoning.

Simulation interactive

Bouge les curseurs : vois le changement en temps réel.

00001011 = 11

Courte vidéo de cours

La vidéo de cours de ce sujet sera ajoutée bientôt.

Examen blanc

L'examen blanc de ce sujet sera ajouté bientôt.

Quiz d'entraînement

Teste-toi : résultats et explications immédiats.

  1. 1. The binary number 1011 equals which decimal value?

  2. 2. How many different values can one byte (8 bits) represent?

  3. 3. The decimal number 13 written in binary is:

Besoin d'aide sur ce sujet ?

Lors d'un appel de découverte gratuit de 30 minutes, nous évaluons ton niveau et construisons un plan d'étude sur mesure.

Appel de découverte gratuit