IGCSE Computer Science · Area 1 · Computer systems

Data representation

Everything a computer stores, from a photo to a program, has to be turned into binary first. This topic covers the denary, binary and hexadecimal number systems and the conversions between them, binary addition and overflow, logical shifts, two's complement, how text, sound and images are represented, how data storage is measured, how to calculate file sizes and why compression is used. The marks you drop here are almost always dropped in the working, not in the idea.

Not started

Syllabus coverage

  • Understand how and why computers use binary to represent all forms of data
  • Understand the denary, binary and hexadecimal number systems
  • Convert between positive denary and positive binary, positive denary and positive hexadecimal, and positive hexadecimal and positive binary
  • Understand how and why hexadecimal is used as a beneficial method of data representation
  • Add two positive 8-bit binary integers, and understand the concept of overflow and why it occurs in binary addition
  • Perform a logical binary shift on a positive 8-bit binary integer and understand the effect this has on the positive binary integer
  • Use the two's complement number system to represent positive and negative 8-bit binary integers
  • Understand how and why a computer represents text and the use of character sets, including ASCII and Unicode
  • Understand how and why a computer represents sound, including the effects of the sample rate and sample resolution
  • Understand how and why a computer represents an image, including the effects of the resolution and colour depth
  • Understand how data storage is measured, including the bit, nibble, byte, kibibyte, mebibyte, gibibyte, tebibyte, pebibyte and exbibyte
  • Calculate the file size of an image file and a sound file, using information given
  • Understand the purpose of and need for data compression, including lossy compression and lossless compression

Part of the IGCSE Computer Science syllabus 0478.

Number systems: one value, three basesThe place value of each bit is a power of two, so reading a binary number is addition.Denary, binary and hexadecimal all describe the same value. You must convert in both directions.An 8-bit binary number: each position is a power of 2112806413211608140201128 + 32 + 16 + 4 = 180 in denarySame number, three basesdenary180base 10, the numbers you count withbinary1011 0100base 2, what the computer storeshexadecimalB4base 16, shorthand for humans4 bits = 1 nibble = 1 hex digit, so binary converts to hex in groups of four.
The three number systems side by side: the same value written in denary, 8-bit binary and hexadecimal, with the place values shown so that each hex digit can be seen to represent four bits.

Why computers use binary, and the number systems you need

Every form of data has to be converted to binary before a computer can process it. That is because the circuits inside a computer are built from transistors that behave like switches, and a switch has only two states: on or off. One switch holds one bit, so a bit is always either 1 (on) or 0 (off). Text, sound, images, video and even the instructions of a program are all stored as patterns of bits. The data is processed using logic gates and held in registers while it is being worked on.

There are three number systems you have to know. Denary is base 10 and uses the digits 0 to 9, and it is the system humans use. Binary is base 2 and uses only 0 and 1, and it is the system the computer uses. Hexadecimal is base 16 and uses 0 to 9 plus A to F, where A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. Hexadecimal is not used by the computer itself; it is a shorthand that makes binary easier for humans to read.

Hexadecimal is useful because exactly one hex digit represents four bits, so 8 bits become two hex digits and 16 bits become four. A value such as 1101 0111 0011 1010 is far easier to read, write down and check as D73A, and long strings of 1s and 0s are easily miscopied. That is why hexadecimal is used wherever addresses and codes are displayed: MAC addresses, IPv6 addresses, the memory addresses shown in error messages, and colour codes in web pages such as #FF8800.

Number systemBaseDigits usedExample
Denary100 to 9173
Binary20 and 11010 1101
Hexadecimal160 to 9 and A to FAD
One hex digit = four bits = one nibble. Two hex digits = eight bits = one byte. Learn that and the conversions stop being guesswork.

Converting between denary, binary and hexadecimal

Denary to binary. Write out the place values 128, 64, 32, 16, 8, 4, 2, 1 and take the largest one that fits, then carry on with what is left. For 173: 128 fits, leaving 45; 64 does not fit; 32 fits, leaving 13; 16 does not fit; 8 fits, leaving 5; 4 fits, leaving 1; 2 does not fit; 1 fits. That gives 1010 1101. Check it by adding the place values of the 1s: 128 + 32 + 8 + 4 + 1 = 173.

Binary to denary. Add up the place values of every bit that is a 1. For 0010 1101 that is 32 + 8 + 4 + 1 = 45.

Binary to hexadecimal. Split the binary into groups of four bits, starting from the right, and convert each group on its own. 1010 1101 becomes 1010 and 1101; 1010 is 10, which is A, and 1101 is 13, which is D, so the answer is AD. If the number of bits is not a multiple of four, pad the left-hand group with zeros first.

Hexadecimal to binary. Replace each hex digit with its own four bits. 2D becomes 0010 for the 2 and 1101 for the D, so 0010 1101. Denary to hexadecimal. Either convert to binary first and group the bits in fours, or divide repeatedly by 16 and read the remainders: 173 ÷ 16 = 10 remainder 13, and 10 is A while 13 is D, so the answer is AD. Hexadecimal to denary. Multiply each digit by its place value: 2D -> (2 x 16) + (13 x 1) = 32 + 13 = 45.

Conversions in the exam can go in either direction and can involve values up to 16 bits, so a 16-bit binary value needs four hex digits.

ConversionMethodWorked example
Denary to binaryTake the largest place value that fits and repeat with the remainder173 -> 1010 1101
Binary to denaryAdd the place values of the bits that are 10010 1101 -> 45
Binary to hexadecimalSplit into groups of four bits from the right and convert each group1010 1101 -> AD
Hexadecimal to binaryReplace each hex digit with its four bits2D -> 0010 1101
Denary to hexadecimalConvert to binary and group in fours, or divide by 16 and read the remainders173 -> AD
Hexadecimal to denaryMultiply each digit by its place value (16, then 1)2D -> 45
Always check a conversion by converting your answer back. If 173 gives 1010 1101, then 1010 1101 must add up to 173.

Adding binary integers, and overflow

Binary addition follows four rules: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, and 1 + 1 = 0 carry 1. When three bits are added together, 1 + 1 + 1 = 1 carry 1. Work from the least significant bit on the right to the most significant bit on the left, carrying into the next column exactly as you do in denary addition.

Here is 0011 0110 (54) added to 0101 1010 (90). Working column by column and carrying where needed gives 1001 0000. Check it in denary: 54 + 90 = 144, and 1001 0000 is 128 + 16 = 144.

An overflow error occurs when the result of a calculation is larger than the largest value the register can hold. An 8-bit register holds any value from 0 to 255, so an overflow error occurs if the answer is greater than 255. A 16-bit register holds up to 65 535, so the same rule applies at a higher limit: a computer has a predefined limit on what it can represent or store, and an overflow error occurs when a value outside that limit should be returned.

Adding 1011 0100 (180) to 0110 1101 (109) gives 289, which is larger than 255. The addition produces a carry out of the most significant bit, but there is nowhere for it to go inside an 8-bit register, so it is lost. The register keeps only 0010 0001, which is 33, and that is completely wrong. The carry out of the most significant bit is the signal that an overflow has happened.

AdditionResultCarry
0 + 00no carry
0 + 11no carry
1 + 01no carry
1 + 10carry 1 into the next column
1 + 1 + 11carry 1 into the next column
A carry out of the most significant bit of an 8-bit addition means the answer is greater than 255, so an overflow error has occurred and the 8-bit result is not the correct answer.

Logical shifts: multiplying and dividing by powers of two

A logical shift moves every bit in the register a set number of places to the left or to the right. In a logical left shift each bit moves one place to the left, a 0 is shifted in at the right-hand end, and any bits pushed off the left-hand end are lost. In a logical right shift each bit moves one place to the right, a 0 is shifted in at the left-hand end, and any bits pushed off the right-hand end are lost.

The effect on the value is predictable. A left shift multiplies the value by 2 for each place shifted, and a right shift divides it by 2 for each place shifted, throwing away any remainder. A multiple shift is just a repeated single shift.

For 0001 0110, which is 22: a left shift of 1 gives 0010 1100 (44); a left shift of 2 gives 0101 1000 (88), which is 22 x 4; a right shift of 1 gives 0000 1011 (11); and a right shift of 2 gives 0000 0101 (5), because 22 ÷ 4 is 5.5 and the 0.5 is lost when the last two bits are shifted off the end.

The danger is losing a significant bit. Left shifting 1100 0011 (195) by one place gives 1000 0110, which is 134, not 390: the 1 in the most significant bit has been shifted off the end and lost, so the doubling has not worked. A left shift only multiplies by 2 if no 1 is lost from the most significant bit, and a right shift only divides exactly if no 1 is lost from the least significant bit.

ShiftValue in 8 bitsDenaryEffect
Start0001 011022the original value
Left shift 10010 110044multiplied by 2
Left shift 20101 100088multiplied by 4
Right shift 10000 101111divided by 2
Right shift 20000 01015divided by 4, remainder lost
Bits shifted off the end are lost and zeros are shifted in at the opposite end. A left shift multiplies by 2 per place and a right shift divides by 2 per place, but only if no 1 is lost.

Two's complement: representing negative integers

Binary has no minus sign, so a computer stores negative integers using the two's complement system. The most significant bit becomes a sign bit: 0 means the value is positive and 1 means it is negative. Positive integers are written in the usual way, with a 0 in the most significant bit.

To write a negative number in 8-bit two's complement, write the positive value in 8-bit binary, invert every bit (change every 1 to a 0 and every 0 to a 1), then add 1. For -25: +25 is 0001 1001; inverting gives 1110 0110; adding 1 gives 1110 0111. So -25 is 1110 0111.

To convert a two's complement value back to denary, look at the sign bit. If it is 0 the value is positive and you simply add the place values. If it is 1 the value is negative: invert all the bits, add 1, and put a minus sign in front. For 1111 0000: the sign bit is 1, so the value is negative; inverting gives 0000 1111, which is 15, and adding 1 gives 16, so the value is -16.

Eight-bit two's complement covers -128 to +127. 1000 0000 is -128 and 0111 1111 is +127, so +128 and -129 cannot be stored in 8 bits. Negative values can also be added and subtracted directly without any special rules, which is one reason computers use two's complement rather than a separate sign bit.

DenaryWorking8-bit two's complement
+25positive, so write the value with a 0 sign bit0001 1001
-25invert 0001 1001 to get 1110 0110, then add 11110 0111
+100positive, so write the value with a 0 sign bit0110 0100
-100invert 0110 0100 to get 1001 1011, then add 11001 1100
-161111 0000 inverted is 0000 1111, add 1 gives 16, so the value is -161111 0000
Two steps for a negative number: invert every bit, then add 1. Forgetting the add 1 is the most common error in this topic.

Text, sound and images: how a computer stores them

Text is stored using a character set, which is an agreed list that gives every character a binary code. ASCII (American Standard Code for Information Interchange) was designed for English and originally used 7 bits, giving 128 characters: the letters, the digits, punctuation marks and some control codes. Because the same code is used by every device, text can be moved between systems and still be read correctly. Unicode was developed because ASCII cannot cover the characters of other languages, and it allows for a much greater range of characters and symbols, including different languages and emojis. Unicode needs more bits per character than ASCII, so a text file that uses Unicode is larger.

Sound is stored by sampling. A microphone turns the sound wave into an electrical signal, and the computer measures that signal at regular intervals and records each measurement as a binary number. The sample rate is the number of samples taken in a second, and the sample resolution is the number of bits used for each sample. Raising either one makes the recording a more accurate copy of the original sound wave, but also increases the file size.

Images are stored as a grid of pixels. Each pixel is given a binary value that represents its colour. The resolution of an image is the number of pixels in the image, and the colour depth is the number of bits used to represent each colour. A higher resolution means more detail, and a higher colour depth means more different colours can be shown, but both increase the file size.

TermWhat it meansEffect of increasing it
Sample rateThe number of samples taken in a secondA more accurate recording of the sound wave, and a larger file size
Sample resolutionThe number of bits used for each sampleEach sample is more precise so the recording is more accurate, and the file size increases
Resolution (image)The number of pixels in the imageMore detail in the image, and a larger file size
Colour depthThe number of bits used to represent each colourMore colours are available and the quality is better, and the file size increases
For sound and for images the pattern is identical: more samples or more pixels, and more bits each time, give better quality and a bigger file. An answer that gives only half of that loses half the marks.

Storage units, file sizes and compression

Data storage is measured in units that each hold a fixed number of the unit before them. A bit is one binary digit. A nibble is 4 bits and a byte is 8 bits, and each step up from a byte is 1024 of the previous unit: 1024 bytes in a kibibyte, 1024 kibibytes in a mebibyte, and so on up through gibibyte, tebibyte, pebibyte and exbibyte. Calculations must use 1024, not 1000.

To find the file size of an image, multiply the number of pixels by the colour depth: file size in bits = resolution x colour depth. For an image of 1024 x 768 pixels with a colour depth of 8 bits: 1024 x 768 = 786 432 pixels; 786 432 x 8 = 6 291 456 bits; ÷ 8 = 786 432 bytes; ÷ 1024 = 768 KiB.

To find the file size of a sound file, multiply the sample rate by the sample resolution by the length of the track in seconds: file size in bits = sample rate x sample resolution x length. For a track recorded at 8192 samples per second with a sample resolution of 16 bits and a length of 8 seconds: 8192 x 16 x 8 = 1 048 576 bits; ÷ 8 = 131 072 bytes; ÷ 1024 = 128 KiB. Always give the answer in the unit the question asks for.

Compression exists to reduce the size of a file. A smaller file needs less storage space, requires less bandwidth when it is sent and takes less time to transmit. Lossy compression reduces the file size by permanently removing data, for example by reducing the resolution or the colour depth of an image, or the sample rate or resolution of a sound, so the file can never be put back exactly as it was. Lossless compression reduces the file size without permanently losing any data, for example run length encoding (RLE), which stores a value once together with the number of times it repeats, so AAAAABBB becomes 5A3B. With lossless compression the original file can be recreated exactly.

UnitNumber of the previous unitWhat it is used for
Bitone binary digitthe smallest unit of storage, a single 0 or 1
Nibble4 bitsone hexadecimal digit
Byte8 bitsone ASCII character
Kibibyte (KiB)1024 bytesmeasuring the size of a small file
Mebibyte (MiB)1024 kibibytesmeasuring the size of a photo or a music track
Gibibyte (GiB)1024 mebibytesmeasuring the size of a video file or a memory card
Tebibyte (TiB)1024 gibibytesmeasuring the capacity of a large hard disk drive
Pebibyte (PiB) and exbibyte (EiB)1024 of the previous unitmeasuring the capacity of large storage systems
Calculations must use 1024 and not 1000, and the answer must be in the units the question asks for. Divide by 8 to turn bits into bytes, then divide by 1024 for each step up.

Key terms you must be able to define

Binary
A base 2 number system that uses only the digits 0 and 1. All data must be converted to binary before a computer can process it.
Denary
A base 10 number system that uses the digits 0 to 9. It is the number system used by humans.
Hexadecimal
A base 16 number system that uses 0 to 9 and A to F, where A is 10 and F is 15. One hex digit represents four bits, so hexadecimal is a shorter way of writing binary.
Overflow
An error that occurs when the result of a calculation is greater than the largest value the register can store, for example greater than 255 in an 8-bit register. The carry out of the most significant bit is lost, so the stored result is wrong.
Logical shift
Moving every bit in a register a set number of places left or right. Bits shifted off the end are lost and zeros are shifted in at the opposite end, so a left shift multiplies by 2 per place and a right shift divides by 2 per place.
Two's complement
The number system used to represent positive and negative 8-bit binary integers. The most significant bit is the sign bit, and a negative value is written by inverting every bit of the positive value and then adding 1.
Character set
An agreed list that gives every character a binary code, so that text can be stored and shared between devices. ASCII and Unicode are character sets.
ASCII
American Standard Code for Information Interchange, a character set originally using 7 bits that gives 128 characters for English letters, digits and punctuation.
Unicode
A character set that allows for a greater range of characters and symbols than ASCII, including different languages and emojis. It requires more bits per character than ASCII.
Sample rate
The number of samples taken in a second when a sound wave is recorded. A higher sample rate makes the recording more accurate and increases the file size.
Sample resolution
The number of bits used for each sample of a sound recording. A higher sample resolution makes each sample more precise and increases the file size.
Resolution (image)
The number of pixels in an image. A higher resolution gives more detail and increases the file size.
Colour depth
The number of bits used to represent each colour in an image. A higher colour depth allows more colours and increases the file size.
Bit
The smallest unit of data storage: one binary digit, either 0 or 1.
Nibble
4 bits, which is the number of bits represented by one hexadecimal digit.
Byte
8 bits, which is enough to store one ASCII character. There are 1024 bytes in a kibibyte.
Lossy compression
Compression that reduces the size of a file by permanently removing data, for example by reducing the resolution or colour depth of an image or the sample rate or resolution of a sound.
Lossless compression
Compression that reduces the size of a file without permanently losing any data, so the original file can be recreated exactly. Run length encoding (RLE) is an example.

Applied to real systems

Cambridge sets 0478 in systems you already use - a phone, a school network, a supermarket till, a website, a bank. Use these as models for how to apply the theory to a context you have not seen before, then write your own.

On a mobile phone

A phone photo is stored as a grid of pixels, each with a binary value for its colour. A camera with a higher resolution and a higher colour depth takes better photographs, but each one takes up more of the phone's storage, which is why the available space is measured in gigabytes and why a full phone stops you taking pictures. Deleting photos frees space because the binary data that represents them is removed.

In a music app

A sound recording is sampled thousands of times a second and each sample is stored as a binary number. A high sample rate and a high sample resolution give a recording that sounds close to the original, which is why a lossless music file is so much larger than the same track compressed lossily. Reducing the sample rate and resolution is exactly what a lossy compression format does to make a track small enough to stream over a phone connection.

In a web page

The colours in a web page are written in hexadecimal, such as #FF8800 for a strong orange. Each pair of hex digits gives the amount of red, green and blue in the colour, so two hex digits cover one colour channel and six digits cover all three. Hexadecimal is used here because it is much shorter and much easier for a designer to read and edit than the equivalent 24 bits of binary.

In a messaging app

Messages are stored in a character set. ASCII would be enough for English letters and digits, but it has no code for the characters of other languages or for emojis, so messaging apps use Unicode. That is why you can send a message in any language and add an emoji to it, and why the same message takes slightly more storage space than a plain English one.

In a games console

A game stores the position of every object on screen as numbers, and two's complement lets it store negative values, such as a character standing to the left of the origin or moving backwards, without needing a separate minus sign. If a value grows past the limit the game has set aside for it, an overflow occurs and the value wraps round, which is what players see when a score suddenly becomes a huge negative number.

Flashcards

Click a card to flip it. Mark honestly — the tracker uses this.

Q1What is the largest value an 8-bit register can hold, and what happens if a calculation gives a larger answer?
255. If the answer is greater than 255 an overflow error occurs: the carry out of the most significant bit is lost, so the 8-bit result is wrong.
Q2How do you convert a positive denary integer into 8-bit binary?
Write the place values 128, 64, 32, 16, 8, 4, 2, 1 and take the largest one that fits, then repeat with the remainder. 173 -> 128 + 32 + 8 + 4 + 1 -> 1010 1101.
Q3How many bits does one hexadecimal digit represent?
Four bits, which is one nibble. So 8 bits is two hex digits and 16 bits is four hex digits.
Q4Give two differences between ASCII and Unicode.
Unicode allows for a greater range of characters and symbols than ASCII, including different languages and emojis. Unicode requires more bits per character than ASCII, so the file is larger.
Q5What is the effect of a logical left shift by two places?
The value is multiplied by 4. Two zeros are shifted in at the right-hand end, and the two most significant bits are lost, so the multiplication only holds if no 1 is lost.
Q6What is the effect of a logical right shift by one place?
The value is divided by 2, with any remainder lost. A zero is shifted in at the left-hand end and the least significant bit is lost.
Q7How do you write a negative integer in 8-bit two's complement?
Write the positive value in 8-bit binary, invert every bit, then add 1. -25 -> 0001 1001 -> 1110 0110 -> 1110 0111.
Q8What range of values can be stored in 8-bit two's complement?
-128 to +127. The most significant bit is the sign bit, so 1000 0000 is -128 and 0111 1111 is +127.
Q9What is the sample rate and what is the sample resolution of a sound recording?
The sample rate is the number of samples taken in a second. The sample resolution is the number of bits used for each sample.
Q10What is colour depth?
The number of bits used to represent each colour in an image. Increasing it allows more colours and increases the file size.
Q11How many bits are in a byte, and how many bytes are in a kibibyte?
8 bits in a byte, and 1024 bytes in a kibibyte. There are 1024 kibibytes in a mebibyte, and 1024 mebibytes in a gibibyte.
Q12What is the difference between lossy and lossless compression?
Lossy compression reduces the file size by permanently removing data, for example by reducing resolution or colour depth. Lossless compression reduces the file size without permanently losing data, for example run length encoding, so the original can be recreated exactly.
0 of 12 marked as known

Exam-style questions

8 questions, 22 marks. Write your answer, then reveal the mark scheme and tick each point you actually made. Answering honestly here is what makes the rest of the site useful.

StateAO11 mark
State what is meant by an overflow error when two positive 8-bit binary integers are added together.

Mark scheme — tick each point you actually made

Examiner tip: One mark, so one clear point is enough. Name the limit of 255 and say the result is therefore wrong. Do not just write 'the answer is too big'.
CalculateAO22 marks
Convert the positive denary integer 173 into 8-bit binary and into hexadecimal. Show your working.

Mark scheme — tick each point you actually made

Examiner tip: Do the binary conversion first and then group the bits in fours from the right. Grouping from the left is the most common way to lose the second mark.
CalculateAO23 marks
The 8-bit binary integers 1011 0100 and 0110 1101 are added together. Calculate the result, state whether an overflow error occurs and explain your answer.

Mark scheme — tick each point you actually made

Examiner tip: Work from the least significant bit and write the carries above the columns. The explanation must link the carry out of the most significant bit to the lost value, not just say that the answer is too big.
CalculateAO22 marks
Convert the negative denary integer -100 into an 8-bit two's complement binary integer. Show your working.

Mark scheme — tick each point you actually made

Examiner tip: Both steps must be visible: the inversion and the add 1. If you only invert the bits you have written the one's complement, and the value is out by one.
CalculateAO24 marks
An image has a resolution of 1024 x 768 pixels and a colour depth of 8 bits. Calculate the file size of the image in KiB. Show your working.

Mark scheme — tick each point you actually made

Examiner tip: Set the calculation out as a chain and keep the unit on every line. Use 1024 to convert to KiB, and never 1000, and give the final answer in KiB because that is what the question asked for.
ExplainAO23 marks
A student records a piece of music at a higher sample rate and a higher sample resolution. Explain the effect this has on the recording and on the file size.

Mark scheme — tick each point you actually made

Examiner tip: Say what each term means before you say what increasing it does. A point that explains only the quality and not the file size leaves one of the three marks on the table.
DescribeAO23 marks
Describe how lossless compression reduces the size of a file, using run length encoding (RLE) as an example.

Mark scheme — tick each point you actually made

Examiner tip: The mark is for 'without permanently losing any data'. That is what separates lossless from lossy, and it must appear in the answer.
ExplainAO24 marks
Explain why hexadecimal is a useful way of representing data in computer science, and give two examples of where hexadecimal is used.

Mark scheme — tick each point you actually made

Examiner tip: The explanation is about humans, not about the computer: the computer still works in binary. Give two clearly different examples, because one example on its own will not score the last mark.

Exam technique for this topic

  • Show your working for every conversion. Even when the final answer is wrong, the method marks are still available, and a conversion with no working scores nothing if the answer is wrong.
  • Group binary into fours before converting to hexadecimal, and write out the place values before you start. Almost every conversion error in this topic comes from misaligning the place values or grouping from the wrong end.
  • For binary addition, work from right to left and write the carries in above the columns. Then say whether an overflow has occurred and why: the answer is greater than 255 and the carry out of the most significant bit is lost.
  • In a file size calculation, keep track of the unit. File size is usually asked for in KiB or MiB, so divide the bits by 8 and then by 1024, and never by 1000. State the unit with your answer.
  • For any question about quality and file size, say both halves: a higher sample rate, sample resolution, resolution or colour depth gives a more accurate or better quality result and a larger file size. The second half is the one students forget.

Why students lose marks here

A student wroteA student wrote: 'A logical left shift of one place always doubles the value of the binary integer.'
Why it loses marksThis is only true when no 1 is shifted off the end. The most significant bit is the one that is lost first, and when it goes the value is not doubled at all. Stating the rule without the condition is the most common loss of a mark in this topic.
The answer that scoresA logical left shift moves every bit one place to the left, shifts a 0 in at the right-hand end and loses any bit pushed off the left-hand end. If no 1 is lost the value is multiplied by 2. If a 1 is lost from the most significant bit the value is not multiplied by 2: left shifting 1100 0011 (195) by one place gives 1000 0110, which is 134, because the 1 worth 128 has been lost.
A student wroteA student converted the hexadecimal number 2D to denary by writing: '2D = (2 x 10) + 13 = 33'.
Why it loses marksThe student has used denary place values on a hexadecimal number. Hexadecimal is base 16, so the place values are 16 and 1, not 10 and 1. The digit D is 13, which is correct, but it has been multiplied by the wrong place value.
The answer that scoresHexadecimal is base 16, so the place values are 16 and 1. 2D -> (2 x 16) + (13 x 1) = 32 + 13 = 45. The same answer can be checked by converting to binary first: 2D is 0010 1101, which is 32 + 8 + 4 + 1 = 45.
A student wroteA student wrote: 'To write -25 in 8-bit two's complement you invert the bits of 0001 1001 to get 1110 0110.'
Why it loses marksThe student has carried out only the first of the two steps. Inverting the bits gives the one's complement, not the two's complement, and the value is out by one. Both steps are needed, and both must be shown to score.
The answer that scoresWrite +25 as 0001 1001. Invert every bit to get 1110 0110, then add 1 to get 1110 0111. So -25 is 1110 0111. You can check it: the sign bit is 1, so the value is negative, and inverting 1110 0111 gives 0001 1000, which is 24; adding 1 gives 25, so the value is -25.
A student wroteA student calculated the size of an image file by dividing the number of bytes by 1000 and wrote the answer as '786 KB'.
Why it loses marksThe syllabus requires calculations to use 1024, not 1000, and the unit asked for was KiB. The method was right but the conversion factor and the unit were both wrong, so the mark was lost at the last step.
The answer that scoresFor an image of 1024 x 768 pixels with a colour depth of 8 bits: 1024 x 768 = 786 432 pixels; 786 432 x 8 = 6 291 456 bits; ÷ 8 = 786 432 bytes; ÷ 1024 = 768 KiB. Use 1024 for every step up between storage units, and give the answer in the unit the question asked for.