Binary 6 – Assorted problems Name: __________________________ Criteria 5 1. Convert the following Decimal numbers to unsigned Binary a) 24 b) 251 2. Convert the following unsigned Binary numbers to Decimal a) 11010 b) 1010101 3. Perform the following arithmetic calculations, using unsigned binary. a) 01101 b) 01001 c) 01111 + 01011 + 0100 + 1 ----------------------------------- 4. Using unsigned binary convert the following decimal numbers to binary a) 59 b) 98 c) 131 5. Convert these decimal numbers to binary using an 8-bit two’s complement representation. (Hint: Take the two’s complement of your answers from Q4) a) -59 b) -98 c) -131 Rosny College 2012, adapted by Claremont College 2014 Page 1 of 4 6. Perform the following calculations, in binary, using two’s complement where necessary a) 3 b) 4 c) 6 + 4 - 4 -3 ------------------- 7. In Two’s Complement arithmetic, explain what is meant by, and how we deal with: a) ‘Overflow’ b) ‘Carry out’ 8. Convert the following binary numbers to decimal, using 8-bit binary floating point representation (with 1 bit for the sign, 3 bits for the exponent in two’s complement, and 4 bits for the mantissa). a) 1 001 1101 sign = exponent = mantissa = number = b) 0 111 1010 sign = exponent = mantissa = number = 9. Convert the following numbers to binary, using the floating point representation described in the previous question. a) 1.75 b) -0.4 Rosny College 2012, adapted by Claremont College 2014 Page 2 of 4 10. Calculate the following file sizes in kilobytes: a) A funky black and white photograph has been taken on an iPhone. It is a surprisingly large image that is square, 1936 pixels each side and uses 32 colours. b) When adding a soundtrack to a YouTube clip, before uploading, you need to consider the size of the music file and how it will affect the overall movie clip size. You have a great soundtrack you would like to use. It goes for a minute and thirteen seconds. It was sampled at 16kHz using 24bit audio. c) The Portable Network Graphics (PNG) file type gives the user a range of options for storing an image. The PNG file is made up of sets of data called chunks. The main IDAT chunk stores the data on each pixel in the image. The data in the PLETE chunk is a colour palette and will be included in the file if needed. The PLETE chunk has a maximum of 256 entries made up of 3 bytes (one byte for red, one for green and one for blue). 8-bit Truecolour One option for storing the image is 8-bit Truecolour which stores all the data in the IDAT chunk. Each pixel is represented by 3 bytes (one byte for red, one for green and one for blue). Rosny College 2012, adapted by Claremont College 2014 Page 3 of 4 eg. Using 8-bit Truecolour, the data in the IDAT chunk for a four-pixel file would be: red byte blue byte green byte 37 44 98 230 2 12 230 2 12 45 120 32 8-bit Indexed-colour Another option for storing the image is 8-bit Indexed-colour which stores data using the IDAT and PLETE chunks. The PLETE chunk stores an entry for each colour used by the image. In the IDAT chunk each pixel is represented by the entry number from the PLETE chunk corresponding to the colour of that pixel. eg. Using 8-bit Indexed-colour, the data in the PLETE chunk for three colours would be: red byte blue byte green byte 37 44 98 230 2 12 45 120 32 The corresponding data in the IDAT chunk for 8-bit Indexed-colour for four pixels would be: index byte 0 1 1 2 A user wishes to store a 290-pixel image that has 200 different colours. Explain, showing your calculations, that it would take less space to store the image using 8-bit Truecolour than using 8-bit Indexed-colour. Rosny College 2012, adapted by Claremont College 2014 Page 4 of 4