Identify and describe primitive data types: integer, real, Boolean, character, string
Represent unsigned integers in binary and convert between binary, denary and hexadecimal
Perform binary addition and recognise overflow
Understand the concepts of bits, bytes, nibbles and their relationship
Primitive Types
Primitive Data Types
Type
Description
Example
Storage
Integer
Whole numbers, positive or negative
42, -7, 0
Typically 32 or 64 bits
Real / Float
Numbers with a fractional part
3.14, -0.5
32 or 64 bits (IEEE 754)
Boolean
Logical value: True or False only
True, False
1 bit (stored as byte)
Character
Single symbol — letter, digit, special
'A', '5', '!'
1 byte (ASCII) / 2+ bytes (Unicode)
String
Sequence of characters
"Hello"
Variable (n × char size)
All data in a computer is ultimately stored as binary (0s and 1s). The data type tells the computer how to interpret the binary pattern.
Binary
Binary Number System
Binary is base 2 — only digits 0 and 1. Each position represents a power of 2, doubling from right to left: 128, 64, 32, 16, 8, 4, 2, 1 for an 8-bit number.
Converting Binary → Denary
Example: 10110101 128+0+32+16+0+4+0+1 = 181
Method: write out powers of 2, multiply each by the corresponding bit, sum the results.
Hexadecimal uses digits 0–9 and letters A–F (A=10, B=11, C=12, D=13, E=14, F=15). One hex digit represents exactly 4 bits (a nibble), so one byte = 2 hex digits.
Binary → Hex
Group binary into nibbles from right: 1011 0101 1011 = 11 = B 0101 = 5 = 5 Result: B5
Hex → Binary
Convert each hex digit to 4 bits: 3F 3 = 0011 F = 15 = 1111 Result: 0011 1111
Hex is used in computing because it is more compact and human-readable than binary. 8-bit binary (00101110) is more easily read as hex (2E). Commonly used for memory addresses, colour codes, and machine code.
Overflow occurs when the result of an arithmetic operation is too large to be stored in the available number of bits. Example: adding two 8-bit numbers giving a result > 255 (unsigned) causes the carry bit to be lost, producing an incorrect result.
Exam Practice
OCR H446 Style · 4 marks
Convert the denary number 219 to: (a) 8-bit binary [1 mark] (b) hexadecimal [1 mark]. Then add 219 and 48 in binary and state whether overflow occurs using 8 bits [2 marks].
[4 marks]
1
(a) 219 in 8-bit binary: 128+64+16+8+2+1 = 1101 1011
1
(b) 1101 = D, 1011 = B → hexadecimal: DB
1
48 in binary = 0011 0000. 1101 1011 + 0011 0000 = 1 0000 1011. The 9th bit (carry) is produced.
1
Overflow does occur because the result (267) exceeds 255, which is the maximum value for an unsigned 8-bit integer. The carry bit is lost.
Common Mistakes
Don't Lose Marks
!
Writing binary conversions right to left then forgetting to reverse — when using the division-by-2 method, remainders are read from bottom to top (most significant bit first). Always double-check by converting back.
!
Forgetting to pad to 8 bits — if a binary result has fewer than 8 digits, pad with leading zeros. 10111 as an 8-bit number is 00010111. OCR mark schemes can penalise answers without correct bit width.
!
Confusing overflow with a carry — a carry out of the most significant bit does not always mean an error in unsigned arithmetic on its own, but if the result cannot be stored in the given bit width, that is overflow. Be precise about what overflows mean in context.