Spring 2018 Comp 162 Peter Smith
Homework #1
Due Date: End of class on Wednesday, February 14th, 2018
Name: ……………………………………..
1. (16 points)
To supplement that data stored on their black boxes, aircraft owned by Swamp County Airlines transmit data every 30 seconds to orbiting satellites. The data sent is as follows:
Heading (0..359 degrees)
Altitude (0..44000 feet to the nearest 200 feet)
Speed (0..600 knots)
Latitude to 1/1000th of a degree, e.g., 34.123 N
Longitude to 1/1000th of a degree, e.g., 118.248 W
Showing your calculation for possible partial credit,
(a) (10 points)
How many bits need be sent each 30 seconds assuming number of bits should be minimized?
(b) (6 points). Given (a), how many bytes of data are transmitted during the course of a 10-hour flight.
2. (16 points)
The Swamp County Computer Corporation designed and built a computer with an 89-bit word length.
(a)Consider the largest positive integer that could be stored
(i)Give its representation in octal – first and last digits only
. . .(ii)Give its representation in hexadecimal - first and last digits only
. . .(b)Consider the most negative number that could be stored
(iii)Give its representation in octal – first and last digits only
. . .(iv)Give its representation in hexadecimal – first and last digits only
. . .3. (24 points)
Consider the six operations in the table below. Operands are signed 5-bit numbers. Complete the table by showing the effect of the operation on each of the 4 status bits NZVC. Possible table entries are
The operation sets the bit to 1 – show this as Y
The operation sets the bit to 0 – show this as N
The operation can have no effect on this bit – show this as NA
Operation / N / Z / V / C00111 + 01111
01010 AND 10101
Arithmetic left shift ( 11000 )
01001 XOR 10011
Arithmetic right shift (00001)
01001 OR 00011
4. (26 points)
When it was first formed, the Swamp County Board of Film Censors awarded one of 6 certificates to new movies: G, PG-9, PG-13, PG, R and NC-17. They were awarded with the following probabilities
G / 0.35PG-9 / 0.05
PG-13 / 0.20
PG / 0.15
R / 0.20
NC-17 / 0.05
(a) (12 points)
Given the probabilities above, devise a Huffman code for the ratings and fill in the following table
Rating / CodeG
PG-9
PG-13
PG
R
NC-17
(b) (4 points). What is the AWCL of your answer to (a)?
(c) ( 6 points)
Later, the PG-9 rating was abolished and merged with the G rating to give the following probabilities
G / 0.40PG-13 / 0.20
PG / 0.15
R / 0.20
NC-17 / 0.05
Given this revision, devise a Huffman code for the ratings and fill in the following table
Rating / CodeG
PG-13
PG
R
NC-17
(d) (4 points). What is the AWCL of your answer to (c)?
5. (18 points)
Fill in the 4 blanks in the following table showing the results of subtracting one 5-bit signed binary number from another. An example is filled in for you.
11001-00111 / 01001 - 01010 / 11100 - 00100 / 01000 - 11110 / 11100 - 11110
10010