Chapter 1 Answers
Chapter 1 Answers
0 0 1 1 0 0 0 0 0
For 96
6 0
1 1 0 1 0 1 1 1
For 215
D 7
1 0 1 1 1 0 1 1 0
For 374
1 7 6
For 96, learners might recognise that 96 is 6 × 16 and so the conversion to the hexadecimal 60 can be done
immediately.
The slow but steady route can be illustrated for the conversion of 374. The initial conversion to binary uses
successive division by two, noting the remainder each time and then reversing the remainders.
The remainders are 0 1 1 0 1 1 1 0 1, which in reverse give the binary as 101110110. For conversion to
hexadecimal, groupings of four bits are converted starting at the least significant (RH) end. 0110 converts to 6 and
0111 to 7, so the hexadecimal representation is 176.
More confident learners might use a short cut. Noting that 374 is greater than 162, a three-digit hexadecimal
representation is expected. Calculating 374 – 256 leaves 118. This can be seen to consist of seven lots of 16s with
6 remaining, hence 176.
Hexadecimal B4 becomes denary 180
Hexadecimal FF becomes denary 255
Hexadecimal 3A2C becomes denary 14 892
128 64 32 16 8 4 2 1
For B4 B 4
1 0 1 1 0 1 0 0
For FF F F
1 1 1 1 1 1 1 1
Question 1.01
Internally never: hexadecimal numbers are primarily used for representation of binary codes for a person to read.
A computer can, therefore, create hexadecimal representations for output. Alternatively, they could possibly be
used for input provided that they were to be converted immediately to binary.
Task 1.02
Table 1.08 in the coursebook shows the binary value for –7 to be 1001. (You may wish to note that there could
have been any number of leading bits set to 1 without the conversion being affected other than to produce
leading zeros in the final answer.) Using the method of retaining the least significant bit and switching the others
gives 0111, which is +7.
Task 1.03
1011 = –23 + 21 + 20 = –8 + 2 + 1 = –5
111011 = –25 + 24 + 23 + 21 + 20 = –32 + 16 + 8 + 2 + 1 = –5
Task 1.04
The method is to take the two’s complement of the binary value for 35 and to add this to the binary value for 67.
The binary equivalent of denary 35 is 00100011, and conversion to two’s complement gives 11011101. Binary for
67 is 01000011. Addition gives (1)00100000. Learners should note that there is a carry bit that cannot be stored in
the byte, but this does not matter because the result in the byte is the binary code for denary 32, which is the
correct answer.
Task 1.05
Suitable examples would be:
Circle: centre coordinates, radius, outline colour, outline style, fill colour.
Rectangle: coordinates of the bottom left corner, coordinates of bottom right corner, length, outline colour,
outline style, fill colour.
Exam-style Questions
1 a i 38 195 from 215 + 212, and so on. (1 + 1)
ii 9533 from four-bit groupings. (1 + 1)
b Any example involving presentation of a hexadecimal representation of a binary code to make it easier for
someone to read. (1)
c i 10010101 because the most significant LHS bit is 1. (1)
ii –107 from –27 + 24 and so on, and 51 from 25 + 24 and so on. (1 + 1)
d Only one representation of zero. Allows simple computation for addition and subtraction. (1 + 1)
e Some possible answers are given below. (1 each, max 3)
BCD values: either two per byte or just one per byte using just four bits.
Two ASCII characters: either using seven bits from each byte or using the full byte including a parity bit.
One Unicode character: using the two bytes.
Bitmap code with any variation: from 16 single-bit pixels for black and white, through two pixels with
each byte representing one of 256 colour codes, to the two bytes representing a colour depth of 16.
Values for sampled sound: sensibly using four bits, one byte or two bytes to represent one sampled value.
A machine code instruction using the two bytes.
A memory address using both bytes.
A floating-point representation (not covered in coursebook).
c The fundamental fact is that the human ear is an imperfect hearing device.
Therefore, lossless compression is not essential; lossy compression can be used.
The MP3 format can make use of the following facts:
some sounds cannot be heard by the human ear
some sounds are less well heard than others
a softer sound in the presence of a louder sound will not be heard well.
Cambridge International AS & A Level Computer Science 9608 paper 12 Q4 November 2015
0 1 1 1 0 1 1 0 1 0 0 0
Because a currency value only has two digits to represent the fractional part, these two numbers in BCD
can occupy one byte. The implied decimal point is between this byte and the byte representing the whole
number value.
There are several points to note. With just two bytes, the range of possible values is very small. In any real
system, there would be an agreed number of bytes to represent a value, always with just one byte
representing the fractional part. The use of the term ‘decimal point’ is valid here because BCD is a
character code for the decimal digits 0–9. The term ‘binary point’ should only be used when the
representation is of a binary number value.
b 17.43
c 1 0 0 1 0 1 1 1 0 1 0 1
+ 0 1 1 1 0 1 1 0 1 0 0 0
= 1 0 0 0 0 1 1 0 1 1 1 0 1
When you add the fractional parts, the result is a sequence of binary digits that is not recognisable as a
BCD value.
The addition of the whole number parts has suffered overflow.
d 0 1 0 1
+ 1 0 0 0
= 1 1 0 1
+ 0 1 1 0
= 1 0 0 1 1
+ 1 1 0 1
+ 0 1 1 0
= 1 0 1 0 0
+ 1 0 0 0 0
+ 0 1 1 0
= 0 0 0 1 0 1 1 1
Note how the calculation starts with the codes for the second decimal place BCD values, then moves on
successively through the higher value BCD codes. At each stage, the initial result has 0110 added to it. At
each stage after the first one, any carry digit is included in the calculation. The final answer shows the
four BCD codes correctly representing the value 17.43.
However, note that the correction factor is only used when an individual addition has produced either an
unrecognisable non-BCD character or there has been an overflow. In the example above, it had to be
used three times.
e Four bits provide 16 distinct combinations. Six of these are not BCD codes; only codes 0000 to 1001 are
needed to represent decimal digits. Because 0110 is binary for decimal 6, this, used as a correction factor,
converts an unrecognisable combination into one that is a BCD code. For example, if an addition had
produced 1010 initially (for example, by adding 0111 to 0011) the corrected answer would be 0001 0000.
f In any binary value, each bit represents a power of two. For the fractional part of a number, this still
applies. An exact value can only exist if the fractional part is a combination of 1/2, 1/4, 1/8, 1/16, and so
on. Decimal .75 is a combination of 1/2 and 1/4. The binary equivalent is .11, giving an exact conversion.
c No. To understand why, it is necessary to consider the implication of the prefix property. For two binary
digits, there are four combinations. Here, 10 and 01 have been used to represent letters; 00 and 11 have
been carried forward to form part of three-digit codes. For three digits, there are eight combinations but
four of these cannot be used to code letters because they begin with 01 or 10. In this scheme, 110 and
111 have been used to code letters; 000 and 001 have been carried forward for four-digit codes.
Crucially, the scheme uses 0000, 0001, 0010 and 0011 to code letters, leaving none to be carried forward.
Another way of seeing this is to look at the tree and note that the lowest level has no free spaces.
d The scheme should use two of the four codes with four digits to code letters. The remaining two four-
digit codes can be used to provide four distinct five-digit codes. Two of the original four-digit codes have
been lost but four new five-digit codes have been created so, overall, two more letters are coded.