Computer Science • Data Representation

Number Systems

Binary base 2

Denary base 10

Hexadecimal base 16

Number Systems — Explanation

The same number, three ways. Binary (base 2) is how a computer holds it, denary (base 10) is how we count, and hexadecimal (base 16) is a short way to write binary: each hex digit stands for four bits. Change the number in any panel, by sliding the bits or typing a value, and the other two follow, each with its working.

Signed numbers (two's complement). Choose Signed and the leftmost bit becomes the sign bit, with a negative place value (−128 in 8 bits). Add up the place values as before, counting the sign bit as negative. To write a negative number in binary, write its size in binary, flip every bit, then add 1. The hex is always the bit pattern, so a negative number and its pattern share the same hex.

Questions. Choose Questions for ten at a time in the size and kind of number chosen (8 or 16 bits, unsigned or signed): each gives a number in one base and asks for it in another. Every wrong option is a common mistake, and picking one says which; the right one shows the working. Start again gives ten new ones.

Objective: convert positive integers between binary, denary and hexadecimal, and represent negative integers in two's complement (Cambridge International AS & A Level Computer Science 9618 1.1; IGCSE 0478 1.1).

Where this fits

  • AP: AP Computer Science Principles Goes beyond AP Computer Science Principles: Hexadecimal and two's complement aren't in AP CSP; binary to and from decimal is.
  • AQA: AQA A Level Computer Science (7517)
  • Cambridge: Cambridge IGCSE Computer Science (0478); Cambridge A Level Computer Science (9618); Cambridge AS Level Computer Science (9618)
  • IB: IB Computer Science HL; IB Computer Science SL
  • Pearson Edexcel International: Edexcel International GCSE Computer Science (4CP0)
  • USDP: USDP Computer Science

Number Systems — Key Terms

Key concepts in English, with te reo Māori, Chinese (Simplified) and Korean.

EnglishTe reo Māori中文(简体)한국어What it means on this page
Binarytāhūrua二进制이진법A number system using only two digits, 0 and 1.
Denary (decimal)pūnaha tekau——The everyday base-10 number system, using digits 0–9.
Hexadecimalno attested term十六进制십육진법A base-16 number system, using digits 0–9 and A–F.
Bitmoka位비트A single binary digit — 0 or 1 — the smallest unit of digital information.
Bytepaita字节바이트A group of 8 bits, treated as a single unit.
Nibbleno attested term半字节니블Half a byte — 4 bits — which converts to exactly one hex digit.
Digitmati——A single symbol used to write a number, e.g. one of 0–9.
Place valueuara tū——The value a digit represents because of its position in a number.
Negative numbertau tōraro——A number below zero, such as −5.
Sign bitno attested term——In signed (two’s complement) numbers, the leftmost bit — 1 means negative.
Convert / conversionhuri——To change a number from one representation into another.
Inputtāuru输入입력A value entered into the system — here, the binary, denary or hex you type or set.
Outputhuaputa输出출력A value the system produces — here, the other two representations it works out for you.

On the te reo Māori column. Terms marked as gaps have no attested equivalent in the sources checked — Karaitiana Taiuru's Dictionary of Māori Computer and Social Media Terms, Paekupu, the Reserve Bank's te reo financial glossary, NZQA and Te Aka. No coinage is printed as though it were established; where a class needs one, commission it from Te Taura Whiri i te Reo Māori and credit the translator. Te reo Māori is not italicised and takes no plural "s".