Pearson Edexcel GCSE (9-1) Computer Science revision notes
Binary Revision Notes
Review revision notes for Binary in Edexcel Computer Science.
At a glance
revision notes
Resource type
Topic
Binary
Revision notes
Understanding Hexadecimal and Binary Conversion Revision Notes
Why Hexadecimal is Used
Hexadecimal provides a more compact and readable way to represent binary data. Since one hexadecimal digit represents exactly four binary digits (a nibble), it significantly reduces the length of numbers, making them easier for humans to read, write, and remember. This is crucial for tasks like debugging, memory dumps, defining colours, and network addressing, where long binary strings would be cumbersome and prone to errors. It acts as a bridge between human readability and machine-level binary data.
Binary to Hexadecimal Conversion
To convert binary to hexadecimal, first, group the binary digits into sets of four, starting from the right. If the leftmost group has fewer than four digits, add leading zeros to complete the group. Then, convert each four-bit group into its single hexadecimal equivalent. For instance, the binary 10110101 can be grouped as 1011 0101. 1011 is B in hex, and 0101 is 5 in hex, so 10110101 binary is B5 hexadecimal.
Hexadecimal to Binary Conversion
To convert hexadecimal to binary, take each hexadecimal digit and convert it into its four-bit binary equivalent. For example, to convert hexadecimal A3 to binary, A is 1010 in binary, and 3 is 0011 in binary. Combining these yields 10100011. It's essential to pad single-digit binary representations with leading zeros to ensure each hexadecimal digit translates into exactly four binary digits, maintaining the correct structure.
Unsigned Integers and Two’s Complement Representation Revision Notes
Unsigned Integers
Unsigned integers represent only non-negative whole numbers (zero and positive integers). All bits in their binary representation contribute to the magnitude of the number. An 8-bit unsigned integer can store values from 0 to 2^8 - 1 (0 to 255). To convert binary to decimal, sum the powers of two where the bit is 1. For example, 00001011 (binary) = 8+2+1 = 11 (decimal).
Two’s Complement Signed Integers
Two’s complement is a standard method for representing signed integers, addressing issues like multiple representations of zero and simplifying arithmetic. The leftmost bit (Most Significant Bit - MSB) serves as the sign bit: 0 for positive, 1 for negative. For positive numbers, the representation is identical to unsigned binary. For negative numbers, the two’s complement is calculated by inverting all bits of the positive equivalent and adding 1. The range for an 8-bit two’s complement goes from -128 to +127. Operations like addition can be performed directly, regardless of the sign.
Converting Negative Numbers to Two’s Complement
To represent a negative number in two’s complement, first take its positive equivalent and represent it in binary. Then, invert all the bits (change 0s to 1s and 1s to 0s). Finally, add 1 to the result. For example, to represent -5 in 8-bit: Positive 5 is 00000101. Invert bits: 11111010. Add 1: 11111011. This is the two’s complement representation of -5. The most significant bit being 1 indicates it's a negative number.
Converting Two’s Complement to Decimal
For positive two’s complement numbers (MSB is 0), convert as normal unsigned binary. For negative two’s complement numbers (MSB is 1), first subtract 1, then invert all the bits. Convert this result to a positive decimal number, and then negate it. Alternatively, treat the MSB as having a negative weight (e.g., -128 for 8-bit) and sum the powers of two for the remaining bits. For example, 11111011 (8-bit two's complement): MSB = 1, so it's -128. Add (64+32+16+8+2+1) = -128 + 123 = -5.
Related topics
Study nearby topics next
Revision hubs
