Binary 6 – Assorted problems

Name: ______Criteria 5

  1. Convert the following Decimal numbers to unsignedBinary
    a) 24b) 251
  1. Convert the following unsigned Binary numbers to Decimal
    a) 11010b) 1010101
  1. Perform the following arithmetic calculations, using unsigned binary.
    a) 01101b) 01001c) 01111
    + 01011+ 0100 + 1
    ------
  1. Using unsigned binary convert the following decimal numbers to binary
    a) 59b) 98c) 131
  1. 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) -59b) -98c) -131

  1. Perform the following calculations, in binary, using two’s complement where necessary
    a) 3b) -4c) 6
    + 4- 4 - 3
    ------
  1. In Two’s Complement arithmetic, explain what is meant by, and how we deal with:
    a) ‘Overflow’
    b) ‘Carry out’
  1. 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 1101sign =
    exponent =
    mantissa =
    number =
    b) 0 111 1010sign =
    exponent =
    mantissa =
    number =
  1. Convert the following numbers to binary, using the floating point representation described in the previous question.
    a) 1.75
    b) -0.4

  1. 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).

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 theIDAT and PLETE chunks. The PLETE chunk stores an entry for each colour used by theimage. In the IDAT chunk each pixel is represented by the entry number from thePLETE chunk corresponding to the colour of that pixel.

eg. Using 8-bit Indexed-colour, the data in the PLETE chunk for three colours wouldbe:

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 pixelswould be:

index byte
0
1
1
2

A user wishes to store a 290-pixel image that has 200 different colours. Explain, showingyour calculations, that it would take less space to store the image using 8-bit Truecolourthan using 8-bit Indexed-colour.

Rosny College 2012, adapted by Claremont College 2014Page 1 of 4