Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Worksheet 1.2: More Challenging Questions: © Cambridge University Press 2016

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Worksheet 1.

2: more challenging questions


1 Binary coded decimal (BCD) can be used to store currency values with each
individual denary digit represented by one BCD code and an implied position for
the decimal point. It is possible to carry out arithmetic using BCD but this
requires a special technique as discussed in the coursebook.

a Use the following diagram to show the BCD representations of the two
numbers 9.75 and 7.68 assuming packed BCD is used.

b If the two numbers are added what is the total expressed as a denary
value?
c If the two binary representations are added ignoring the fact that they are
BCD codes what is the result obtained?

d Show a correct calculation using the BCD values but applying the correction
factor 0110.

e Why does this correction factor work?

f 9.75 can be represented exactly as a fixed-point binary value but 7.68


cannot. Why is this so?

2 The following table is a rearranged version of Table 1.04 in the coursebook. It


shows a possible set of Huffman codes to be used for lossless compression of a
text consisting only of the eight letters shown.

e t o h l p w z
10 01 111 110 0001 0000 0011 0010
The codes will have been chosen by using an algorithm that has as input the
frequencies of occurrence of each of the letters in the particular text. The choice
of codes can be represented as a Huffman tree. A partially completed tree is
shown below:

e t

p THIS NEEDS DRAWING


<Figure 1.02 z PROPERLY> b

© Cambridge University Press 2016


a Can you work out the rules that are being used to position the letters on the
tree so that they have the codes as shown in the table?
b Can you complete the tree by placing the remaining letters?
c Could this tree be extended to include more letters? If not why not?
d Can you suggest a modification of the tree to include two more letters?

© Cambridge University Press 2016

You might also like