logo

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

Pearson EdexcelGCSE (9-1)Computer SciencePaper 1 (1CP2/01)

Revision notes

  • Understanding Binary Data Representation Revision Notes

    Binary as the Foundation of Computing

    All data within a computer, regardless of its type (e.g., numbers, text, images, sound, program instructions), is represented using binary. Binary is a base-2 number system, meaning it only uses two symbols: 0 and 1. Each 0 or 1 is known as a 'bit', which is the smallest unit of digital information.

    Determining Maximum States with Binary Patterns

    The number of distinct items or states that can be represented by a binary pattern depends on its length (number of bits). For a pattern with 'n' bits, the maximum quantity of unique states that can be represented is calculated using the formula 2^n. For example, 4 bits can represent 2^4 = 16 different states (from 0000 to 1111).

    Examples of Binary Representation

    Numbers are represented directly in binary. Text characters are assigned unique binary codes (e.g., using ASCII or Unicode). Images are broken down into pixels, each with a binary code representing its colour. Sound is sampled, and each sample's amplitude is converted into a binary value. Program instructions are also represented as specific binary codes that the CPU can execute.

  • 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.

  • Converting Between Denary and 8-bit Binary Revision Notes

    Unsigned 8-bit Binary to Denary Conversion

    To convert an 8-bit unsigned binary number to denary, write down the powers of two above each binary digit, starting from 128 (2^7) on the far left, down to 1 (2^0) on the far right. Then, sum the powers of two where there is a '1' in the binary number. For example, 01010101 binary is 64 + 16 + 4 + 1 = 85 denary. The range for unsigned 8-bit binary is 0 to 255, as all eight bits are used to represent magnitude.

    Denary to Unsigned 8-bit Binary Conversion

    To convert a denary number to an 8-bit unsigned binary, you can use the repeated division by 2 method, collecting the remainders in reverse order. Alternatively, find the largest power of two less than or equal to the denary number, place a '1' in that bit position, subtract it from the denary number, and repeat until the denary number is zero. For example, to convert 200 denary: 128 (1), remainder 72; 64 (1), remainder 8; 32 (0); 16 (0); 8 (1), remainder 0; 4 (0); 2 (0); 1 (0). So, 200 denary is 11001000 binary. All 8 bits must be present.

    Signed 8-bit Binary (Two's Complement) to Denary Conversion

    For signed 8-bit binary using Two's Complement, the leftmost bit (most significant bit) represents -128 (not +128). The remaining seven bits represent positive powers of two (64, 32, 16, 8, 4, 2, 1). If the MSB is 0, the number is positive, and you convert it like unsigned binary. If the MSB is 1, the number is negative. To convert, sum the values of all bits where '1' appears, with the MSB contributing -128. For example, 10000001 is -128 + 1 = -127. The range for signed 8-bit binary is -128 to +127.

    Denary to Signed 8-bit Binary (Two's Complement) Conversion

    To convert a positive denary number (up to +127) to Two's Complement, convert it directly to a normal 8-bit binary, ensuring the MSB remains 0. For example, +42 is 00101010. To convert a negative denary number (down to -128), first convert its positive equivalent to 8-bit binary. Then, invert all the bits (0 becomes 1, 1 becomes 0) and add 1 to the result. For example, to convert -5: +5 is 00000101. Invert: 11111010. Add 1: 11111011. This is -5 in Two's Complement.

  • Binary Addition and Shifts Revision Notes

    Binary Addition Fundamentals

    Binary addition follows specific rules: 0+0=0, 0+1=1, 1+0=1, and 1+1=0 with a carry of 1. When a carry (1) is added to 1, it results in 0 with another carry of 1. This process is crucial for representing sums of numbers in computers.

    Logical Shifts

    A logical shift moves all bits in a binary pattern to the left or right. For a left logical shift, zeros are inserted on the right, and bits on the left are discarded. This effectively multiplies positive numbers by powers of 2. For a right logical shift, zeros are inserted on the left, and bits on the right are discarded, effectively dividing by powers of 2 for positive numbers.

    Arithmetic Shifts

    Arithmetic shifts are similar to logical shifts but are designed to handle signed numbers more appropriately. A left arithmetic shift is identical to a left logical shift: zeros are inserted on the right. A right arithmetic shift preserves the sign of the number by replicating the original most significant bit (MSB) as bits are shifted right, while discarding bits from the right.

Revision hubs

Keep studying from the right hub