2022 May/June · Paper 12 · Q3 (c, e)4 marksBinary arithmetic & two's complement · Number conversions & units
No questions match this filter.
References only, not question text. Open Official paper ↗ where Cambridge publishes the paper,
or see the official Cambridge past-papers page; for other papers, ask your
school. “Paper 42” means Paper 4, variant 2.
Practice questions
Original questions written by HomiLabs in the style of the exam, with answers and mark schemes. They are not
Cambridge past paper questions and have not been reviewed by Cambridge. Try each one before opening the answer.
Q1Bitmap & vector graphics · Core · Paper 1 style · 5 marks
(a)Define the term pixel.[1]
(b)Define the term image resolution.[1]
(c)Define the term colour depth.[1]
(d)A bitmap file has a file header. State two items of data that are stored in the file header.[2]
Show answer
(a) The smallest addressable element (dot) of a bitmap image, which has a single colour.
B1: smallest element / dot of a bitmap image that can be given a colour.
(b) The number of pixels in the image, given as width × height in pixels.
B1: number of pixels (wide × high) in the image. Do not accept screen resolution or 'pixels per inch of a screen'.
(c) The number of bits used to store the colour of each pixel.
B1: number of bits per pixel (used to represent its colour).
(d) Any two of: image width in pixels, image height in pixels, colour depth (bits per pixel), file type / format, file size, compression type used.
1 mark each for any two of: width; height (or resolution); colour depth; file type; file size; compression method; colour palette information.
Q2Bitmap & vector graphics · Core · Paper 1 style · 4 marks
A digital camera used by a wildlife survey team in the Margalla Hills takes bitmap photographs with a resolution of 1600 × 1200 pixels and a colour depth of 24 bits. Ignore any file header data.
(a)Calculate the file size of the image in bytes. Show your working.[2]
(b)Convert your answer to part (a) into mebibytes (MiB). Give your answer correct to 2 decimal places.[2]
Q3Bitmap & vector graphics · Core · Paper 1 style · 6 marks
(a)For each use below, state whether a bitmap or a vector graphic is more suitable and give a reason.(i) A photograph of the Badshahi Mosque at sunset(ii) A floor plan of a new school building made from lines and rectangles(iii) A road-sign icon that will appear in an app at many different sizes[6]
Show answer
(a) (i) Bitmap – a photograph has continuous colour/shading and fine detail that cannot be made from simple shapes. (ii) Vector – it is made of simple geometric shapes, so file size is small and it can be scaled/edited precisely. (iii) Vector – it can be resized to any size without losing quality.
Each item: B1 correct choice, B1 matching reason. Reason must fit the use, e.g. (i) photo detail / varying colours; (ii) geometric shapes, precise editing of objects; (iii) scaling without pixelation.
Q4Bitmap & vector graphics · Standard · Paper 1 style · 5 marks
A photo booth at a wedding hall in Lahore saves each photograph as a bitmap image of 800 × 600 pixels that can show 256 different colours.
(a)State the colour depth that is needed for 256 colours.[1]
(b)Calculate the file size of one photograph in kibibytes (KiB). Ignore the file header.[2]
(c)The booth stores the photographs on a 2 GiB memory card. Calculate the maximum number of complete photographs that can be stored on the card.[2]
M1: 2 × 2³⁰ ÷ 480 000 (= 4473.9…); A1: 4473 (must round down to whole photographs).
Q5Bitmap & vector graphics · Standard · Paper 1 style · 4 marks
(a)Explain the effect on the image and on the file size of increasing the colour depth from 8 bits to 16 bits, without changing the resolution.[2]
(b)A student reduces the resolution of a bitmap image from 1200 × 900 pixels to 400 × 300 pixels and then displays it at the original size. Explain why the displayed image looks blocky (pixelated).[2]
Show answer
(a) More colours can be shown (65 536 instead of 256) so colours are more accurate/realistic; the file size doubles because each pixel needs twice as many bits.
1 mark each: more colours available / smoother, more accurate colour; file size increases (doubles) as more bits per pixel.
(b) There are fewer pixels (one ninth as many), so each pixel must be enlarged to fill the same area; detail is lost and individual pixels become visible as blocks.
1 mark each: fewer pixels store less detail; each pixel is stretched over a larger area so the pixels become visible / edges become jagged.
Q6Bitmap & vector graphics · Standard · Paper 1 style · 7 marks
A cricket club in Sialkot is designing a logo made from simple shapes. The logo will be printed on small membership cards and on a large banner above the stadium entrance. The designer stores it as a vector graphic.
(a)Explain what is meant by a drawing list in a vector graphic.[2]
(b)One object in the logo is a circle. Its centre is at (120, 80) and its radius is 40. State three other properties that would be stored for the circle in the drawing list.[3]
(c)Explain why a vector graphic is more suitable than a bitmap for this logo.[2]
Show answer
(a) A list of the commands/objects that make up the image; each object is stored with its properties (for example coordinates, size, colours) so the image can be redrawn from the list.
1 mark each: a set of instructions/commands to draw the shapes (objects); each object has its properties stored, e.g. position, dimensions, line colour, fill colour.
(b) Any three of: line (outline) colour, line thickness, fill colour, line style (solid/dashed), layer/drawing order, transparency.
1 mark each for any three relevant properties other than centre and radius: line colour; line width/thickness; fill colour; line style; layer/z-order; opacity.
(c) The logo is printed at very different sizes; a vector graphic can be scaled to any size without losing quality because it is redrawn from the drawing list, and its file size is small because it only has simple shapes.
1 mark each, max 2: scales without pixelation / loss of quality (needed for both card and banner); file size small for simple geometric shapes / independent of output size; shapes can be edited individually.
Q7Bitmap & vector graphics · Standard · Paper 1 style · 5 marks
A tourism office in Gilgit has a simple map of hiking routes made of coloured lines and labelled triangles. It has one version stored as a bitmap and one as a vector graphic.
(a)Describe what happens to the quality of each image when it is enlarged to four times its width and height.[4]
(b)State one reason why the vector version of the map has a much smaller file size than the bitmap version.[1]
Show answer
(a) Bitmap: each pixel is enlarged so the image becomes pixelated/blocky with jagged edges; no new detail is added. Vector: the shapes are recalculated from their properties and redrawn, so lines stay sharp and quality is unchanged.
Bitmap (2): pixels stretched/made larger; image becomes blocky / blurred / jagged. Vector (2): objects redrawn using coordinates/properties; no loss of quality / edges remain smooth.
(b) Only the properties of a few shapes (lines, polygons) are stored, rather than the colour of every pixel.
B1: stores shape definitions/properties instead of data for every pixel.
Q8Bitmap & vector graphics · Challenge · Paper 1 style · 5 marks
A weather satellite takes bitmap images of 2048 × 1024 pixels. Each image must be no larger than 3 MiB of pixel data so that it can be sent to the ground station in Karachi during one pass.
(a)Calculate the maximum colour depth that can be used. Show your working.[3]
(b)State the maximum number of different colours that each image can then contain.[1]
(c)The stored files turn out to be slightly larger than 3 MiB. Give one reason why.[1]
(c) The file also contains a file header (metadata such as width, height and colour depth).
B1: file header / metadata is stored in addition to the pixel data.
Q9Bitmap & vector graphics · Challenge · Paper 1 style · 6 marks
A quality-control camera in a textile factory in Faisalabad captures images of cloth with a resolution of 1920 × 1080 pixels and a colour depth of 24 bits.
(a)Calculate the file size of one uncompressed frame in MiB. Give your answer correct to 2 decimal places.[2]
(b)The camera records 30 frames every second. Calculate the storage needed for 10 seconds of uncompressed frames in GiB. Give your answer correct to 2 decimal places.[2]
(c)Suggest why the factory stores the images as bitmaps and not as vector graphics.[2]
(c) The images are photographs of real objects with continuous variation of colour and fine detail; these cannot be described efficiently as geometric shapes, and the camera captures pixels directly.
1 mark each: real-world image / photograph with complex detail; would need a huge number of objects (or cannot be represented) as a vector; camera sensor produces pixel data.
Q10Number conversions & units · Core · Paper 1 style · 4 marks
(a)Convert the denary number 181 into 8-bit binary.[1]
(b)Convert the denary number 181 into hexadecimal.[1]
(c)Convert the hexadecimal number 3E7 into denary. Show your working.[2]
Show answer
(a) 10110101
B1: 10110101.
(b) B5
B1: B5 (1011 = B, 0101 = 5).
(c) 999
M1: 3 × 256 + 14 × 16 + 7; A1: 999.
Q11Number conversions & units · Core · Paper 1 style · 4 marks
(a)Represent the denary number 739 in Binary Coded Decimal (BCD).[1]
(b)Give one example of where BCD is used and explain why it is suitable.[2]
(c)Explain why the 4-bit pattern 1100 can never appear in valid BCD.[1]
Show answer
(a) 0111 0011 1001
B1: 0111 0011 1001 (one 4-bit nibble per denary digit).
(b) A digital clock or calculator display: each digit is shown separately, so storing each denary digit as its own 4-bit code makes it easy to send to each display segment.
B1 use: digital clock / calculator / electronic display / financial values. B1 reason: each denary digit coded separately so it maps directly to a display digit (or avoids rounding errors in money).
(c) 1100 is 12 in denary; BCD only uses the patterns for 0 to 9 (0000 to 1001).
B1: it represents 12, which is not a single denary digit (0–9).
Q12Number conversions & units · Standard · Paper 1 style · 4 marks
(a)A register holds the 16-bit pattern 0100 1001 0010 0101. State the denary value it represents when it is interpreted as:(i) Binary Coded Decimal(ii) an unsigned binary integer.[3]
(b)Write the same 16-bit pattern in hexadecimal.[1]
Show answer
(a) (i) 4925 (ii) 18 725
(i) B1: 4925. (ii) M1: sum of place values 16 384 + 2048 + 256 + 32 + 4 + 1; A1: 18 725.
(b) 4925
B1: 4925 (hex). Note it looks the same as the BCD reading because every nibble is 9 or less.
Q13Number conversions & units · Standard · Paper 1 style · 4 marks
(a)State the number of bytes in 3 MiB.[1]
(b)A shopkeeper in Hyderabad buys a USB flash drive labelled 2 GB. His computer reports the capacity in GiB. Calculate the difference, in bytes, between 2 GiB and 2 GB.[2]
(c)Explain why the computer shows a number smaller than 2 for the capacity of the drive.[1]
Q15Number conversions & units · Challenge · Paper 1 style · 4 marks
(a)Convert the binary number 1010111100 into hexadecimal.[1]
(b)A sensor sends a temperature to a control unit as two BCD digits in one byte. The byte received is 1001 0110. State the temperature it represents.[1]
(c)The same byte 1001 0110 is read by mistake as an unsigned binary integer. State the value that would be read and the error made.[2]
Show answer
(a) 2BC
B1: group from the right: 10 1011 1100 → 2BC.
(b) 96
B1: 1001 = 9, 0110 = 6 → 96.
(c) 150; the reading is 54 too high.
B1: 150. B1: error of 54 (150 − 96).
Q16Compression · Core · Paper 1 style · 6 marks
(a)Describe the difference between lossy and lossless compression.[2]
(b)For each file below, state whether lossy or lossless compression should be used and give a reason.(i) A spreadsheet of student fees for a school in Multan(ii) A video clip to be shared on social media[4]
Show answer
(a) Lossless compression reduces file size without losing any data, so the original file can be reconstructed exactly. Lossy compression permanently removes some data (usually detail people will not notice), so the original cannot be restored exactly.
1 mark each: lossless – no data lost / original can be restored exactly; lossy – data permanently removed / original cannot be restored.
(b) (i) Lossless – every number must be kept exactly; losing data would change the fees. (ii) Lossy – a smaller file is needed for fast upload/streaming, and the small loss of quality is not noticed.
Each: B1 choice + B1 reason. (i) exact data required / text and numbers must not change. (ii) much smaller file / faster to send; loss of quality acceptable or not noticeable.
Q17Compression · Core · Paper 1 style · 5 marks
(a)Show how the string AAAAABBBCDDDDDDDD could be compressed using run-length encoding.[2]
(b)Each count and each character is stored in one byte. Calculate the number of bytes saved.[1]
(c)Explain why using RLE on the string 'PAKISTAN' would increase its size.[2]
Show answer
(a) 5A 3B 1C 8D
M1: counts with characters; A1: 5A 3B 1C 8D.
(b) 9 bytes
B1: 17 − 8 = 9.
(c) There are no repeated adjacent characters, so every character becomes a run of 1 and needs a count byte as well; 8 bytes become 16 bytes.
1 mark each: no consecutive repeats / every run has length 1; each character now needs 2 bytes, doubling the size (8 → 16).
Q18Compression · Standard · Paper 1 style · 6 marks
One row of a bitmap image uses these colour codes, from left to right (W = white, B = blue, R = red):W W W W W W B B B W W W W W W W W R R B B B B B
(a)Show the result of compressing this row using run-length encoding (RLE). Write each run as a count followed by the colour code.[2]
(b)Each colour code and each count is stored in one byte. Before compression, each pixel uses one byte. Calculate the number of bytes saved by compressing this row.[2]
(c)Explain why RLE is not effective for a photograph of a busy bazaar.[2]
Show answer
(a) 6 W 3 B 8 W 2 R 5 B
M1: runs identified correctly (at least three); A1: 6W 3B 8W 2R 5B in order.
(c) In a photograph neighbouring pixels are rarely exactly the same colour, so runs are very short (often length 1); each pixel would need a count as well as its colour, so the file may get bigger.
1 mark each: few / short runs of identical pixels; each run still needs two bytes so file size may increase.
Q19Compression · Standard · Paper 1 style · 4 marks
(a)The 8-bit greyscale image data below has been compressed with run-length encoding. Each pair of numbers is (count, grey value):12, 0, 4, 255, 7, 0, 9, 128State how many pixels are in the decompressed data.[1]
(b)Each number in the compressed data is stored in one byte. Calculate the ratio of uncompressed size to compressed size, in its simplest form.[2]
(c)Describe the decompressed data by stating the first 14 grey values in order.[1]
(c) Twelve 0s followed by two 255s: 0,0,0,0,0,0,0,0,0,0,0,0,255,255
B1: 12 × 0 then 255, 255.
Q20Compression · Challenge · Paper 1 style · 5 marks
A music streaming service based in Karachi compresses its songs before sending them to listeners' phones.
(a)Explain how lossy compression reduces the size of a music file.[3]
(b)A hospital in Quetta stores X-ray images that doctors use for diagnosis. Justify why the hospital should use lossless compression for these images.[2]
Show answer
(a) Perceptual coding removes sounds that the human ear cannot hear or will not notice: frequencies outside the range of human hearing are removed, quiet sounds masked by louder sounds at the same time are removed, and the sampling resolution / bit rate is reduced.
1 mark each, max 3: uses perceptual music shaping / psychoacoustics; removes frequencies humans cannot hear; removes quieter sounds masked by louder ones; reduces bit rate / sampling resolution; data removed is lost permanently.
(b) Lossy compression could remove fine detail or create artefacts; a doctor might miss a small fracture or misdiagnose, so every pixel must be kept exactly as captured.
1 mark each: all original detail must be kept / no artefacts; missing detail could lead to wrong diagnosis (medical/legal consequences).
Q21Binary arithmetic & two's complement · Core · Paper 1 style · 4 marks
(a)Convert −45 into an 8-bit two's complement binary integer.[2]
(b)Convert the 8-bit two's complement integer 10110110 into denary.[2]
M1: −128 + 32 + 16 + 4 + 2; A1: −74 (the minus sign is needed).
Q22Binary arithmetic & two's complement · Standard · Paper 1 style · 4 marks
(a)Add these two 8-bit binary integers. Show your working.01101100 + 01011010[2]
(b)The two numbers in part (a) are stored as 8-bit two's complement integers. Explain why the result of the addition is not correct.[2]
Show answer
(a) 11000110
M1: correct carries shown; A1: 11000110.
(b) 108 + 90 = 198, which is greater than 127 (the largest 8-bit two's complement value); the answer 11000110 has a 1 in the sign bit so it is read as −58. This is overflow.
1 mark each: 108 + 90 = 198 is out of range (max +127) / overflow; result's MSB is 1 so it is read as a negative number (−58).
Q23Binary arithmetic & two's complement · Standard · Paper 1 style · 5 marks
(a)Write 87 and −113 as 8-bit two's complement integers.[2]
(b)Use two's complement addition to calculate 87 − 113. Show your working and give the result in binary and in denary.[3]
Show answer
(a) 87 = 01010111; −113 = 10001111
B1: 01010111. B1: 10001111.
(b) 11100110 = −26
M1: 01010111 + 10001111 with carries; A1: 11100110; A1: −26.
Q24Binary arithmetic & two's complement · Challenge · Paper 1 style · 6 marks
A depth sensor on a research ship records readings as 12-bit two's complement integers.
(a)State the range of values that can be stored in 12-bit two's complement.[2]
(b)Write −300 as a 12-bit two's complement integer.[2]
(c)The 12-bit value from part (b) is copied into a 16-bit register. State the 16-bit pattern that keeps the same value, and explain how it was formed.[2]
(c) 1111 1110 1101 0100; the sign bit (1) is copied into the four new most significant bits (sign extension).
B1: 1111 1110 1101 0100. B1: extended by repeating the sign bit / MSB.
Q25Sound representation · Core · Paper 1 style · 5 marks
(a)Define the term sampling rate.[1]
(b)Define the term sampling resolution.[1]
(c)Describe how an analogue sound wave is converted to digital data.[3]
Show answer
(a) The number of samples of the sound (amplitude) taken per second.
B1: number of samples taken per second (measured in Hz).
(b) The number of bits used to store each sample.
B1: number of bits per sample (bit depth).
(c) The amplitude of the sound wave is measured at regular time intervals (sampling); each measured amplitude is approximated to the nearest available level (quantised); each value is stored as a binary number using a fixed number of bits.
1 mark each: amplitude measured/sampled; at regular (set) intervals; each sample rounded to nearest value that can be represented and stored in binary (using the sampling resolution); uses an ADC. Max 3.
Q26Sound representation · Standard · Paper 1 style · 3 marks
A qawwali group records a 3-minute song in stereo (2 channels) with a sampling rate of 44.1 kHz and a sampling resolution of 16 bits. Ignore any file header.
(a)Calculate the file size of the recording in bytes. Show your working.[2]
(b)Convert your answer to MiB, correct to 2 decimal places.[1]
Q27Sound representation · Standard · Paper 1 style · 4 marks
(a)Explain the effect of increasing the sampling rate on the recording and on the file size.[2]
(b)Explain the effect of increasing the sampling resolution from 8 bits to 16 bits.[2]
Show answer
(a) More samples are taken per second, so the digital sound is closer to the original analogue wave (higher frequencies captured); the file size increases because more samples are stored.
1 mark each: more accurate / closer to original / higher quality; larger file.
(b) Each sample can take one of 65 536 levels instead of 256, so amplitudes are stored more precisely (less quantisation error, better dynamic range); each sample needs twice the bits, so the file size doubles.
1 mark each: more levels / more accurate amplitude / less rounding error; file size doubles (more bits per sample).
Q28Sound representation · Challenge · Paper 1 style · 5 marks
A journalist in Peshawar uses a voice recorder that stores mono sound with a sampling resolution of 8 bits on a 512 MiB memory card. Ignore any file header.
(a)Calculate the maximum whole-number sampling rate, in Hz, that would allow 6 hours of recording to fit on the card. Show your working.[3]
(b)The journalist decides to use 8 kHz instead. Give one advantage and one disadvantage of this choice.[2]
(b) Advantage: far more recording time / smaller files, and speech is still understandable. Disadvantage: lower quality – higher frequencies are lost, so voices sound less clear.
B1 advantage: smaller files / more recording time / quicker to upload. B1 disadvantage: lower quality / higher frequencies not captured.
Q29Character sets · Core · Paper 1 style · 4 marks
(a)In ASCII the character 'D' has the denary code 68. State the 8-bit binary code for the character 'K'.[2]
(b)Explain why a text-messaging app used in Pakistan stores its text in Unicode rather than ASCII.[2]
Show answer
(a) 01001011
M1: K is 7 letters after D so 68 + 7 = 75; A1: 01001011.
(b) ASCII only has 128 (or 256 extended) codes, which cover English letters but not Urdu script; Unicode uses more bits per character, so it can represent characters from almost all languages, including Urdu and emojis.
1 mark each: ASCII has limited characters (7/8 bits) / no Urdu characters; Unicode uses more bits (16/32) giving many more characters, covering other languages/scripts.
Q30Character sets · Standard · Paper 1 style · 5 marks
(a)The ASCII code for 'g' is 103. State the ASCII code for 'G' and explain the relationship between them.[2]
(b)A message has 350 characters. Calculate how many more bytes it needs when it is stored using a 16-bit Unicode encoding than when it is stored using 8-bit ASCII.[2]
(c)Explain why the ASCII codes for the digit characters '0' to '9' are not the same as the numbers 0 to 9.[1]
Show answer
(a) 71; uppercase codes are 32 less than the matching lowercase codes.
B1: 71. B1: difference of 32 (bit 5 is 0 for uppercase / 1 for lowercase).