Review Questions For Midterm


Units of Information


Bit, byte, kilobyte, megabyte, etc., number of different bit sequences of a given length, hexadecimal as a compact scheme for writing binary.

Sample questions (a calculator is helpful for the first two; you only need a table of powers of two, which I will supply, for the third one).

1. A slow dialup modem connection transmits  28,000 bits per second.  How long will it take to transmit  a 10MB file?

2. A square bitmapped image (N pixels wide by N pixels high) is to be stored in 1MB.  The image is coded as a color bitmap image, with 3 bytes for each pixel and a 54 byte header.  How large can N be?

3. How many different sequences of 6 hex digits are there?

Binary Encoding of Integers


Understand how positional number representation works, and know how to convert between representations at different bases

4. Make up your own problem!  Here is the problem template--write a sequence of either hex digits, bits, or decimal digits (not too long!) Show the two other representations of the same integer.  For instance, if you chose decimal and wrote down 1209, you should compute both the binary and hex representations of one thousand two hundred nine.  You should be able to do all such problems.

5.  Make up another problem.  Write down two sequences of bits or hex digits, and add, subtract or multiply them without changing the base.

Binary Encoding of Characters


Understand that ASCII uses one byte to represent a character.  For problems involving ASCII I will provide a table of ASCII encodings. 

6. Suppose a file consists of a long sequence of bytes, each with a value between zero and nine.  You want to replace each of these bytes by the ASCII encoding of the corresponding character; i.e., 0 should be replaced by the character '0', 1 by '1', etc.   How would we carry this out using something like the Binary Editor program, where we get to apply simple modifications to the various bytes, or ranges of bytes, in the file?

7. Here is a slightly harder version of the same problem:  Suppose the original file contains byte values zero through fifteen, and you want to replace each byte by the ASCII encoding of the corresponding hex symbol.  So bytes with values zero through nine will be treated as before, and bytes with values ten through fifteen will be changed into characters 'A' through 'F'.

Binary Encodings of Images and Sounds


Understand how color bitmap, grayscale bitmap, and audio wave files are encoded.

8. Suppose we wish to conceal a secret message in a .wav audio clip.  The clip is just like the ones we used in class: monaural, with a sampling rate of 11025 hertz and one byte per sample.  The secret message is hidden by changing one bit of each sample in the audio clip.  For instance, suppose we choose to conceal the message in the lowest-order bits of each sample, so that if the first byte of audio is, say, 11001001 and the first bit of the secret message is 0, then we would change the first audio sample to 11001000, but if the first bit of the message is 1, we would leave the first audio sample unchanged.  The idea is that changing one bit of each sample should (?) be imperceptible when the clip is played by an unsuspecting person.

(a) Suppose the message is 1KB.  How long an audio clip (in terms of duration) would you need to conceal the message?
(b) Is it better to change the low-order bit of each sample, as described above, or the high-order bit, or doesn't it matter?  Explain.