Assignment 1, Solutions

Part of the homework for 22C:60 (CS:2630), Fall 2011
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

  1. What is your E-mail address?

    No solution offered.

    Real Homework!

  2. Background: Prior to 1928, punched cards were primarily used for numeric data, Each "character" was coded by one column on the card, by punching in just one of the 12 rows of the card. If we represent punches with 1 and no punch with 0, the character set was:
            000000000000 space      
            100000000000 + (sometimes)    000000100000 4
            010000000000 - (sometimes)    000000010000 5
            001000000000 0                000000001000 6
            000100000000 1                000000000100 7
            000010000000 2                000000000010 8
            000001000000 3                000000000001 9
    

    In 1928, IBM extended their code, supporting upper case letters encoded with 2 punches (they called these multipunch codes), one punch in positions +, - or 0 (the zone punch) positions, and one punch in the 1 through 9 positions (the numeric punch):

            100100000000 A (+ 1)          010000000010 Q (- 8)
            100010000000 B (+ 2)          010000000001 R (- 9)
            100001000000 C (+ 3)          001010000000 S (0 2)
                - - -                     001001000000 T (0 3)
            100000000010 H (+ 8)              - - -
            100000000001 I (+ 9)          001000000010 Y (0 8)
            010100000000 J (- 1)          001000000001 Z (0 9)
            010010000000 K (- 2)
    

    Question: Give the punched card encoding for "HELLO WORLD" (not including the quotes).

    See left column below. The right column is the answer to the next question.

            100000000010 H (+ 8) 011000
            100000010000 E (+ 5) 010101
            010001000000 L (- 3) 100011
            010001000000 L (- 3) 100011
            010000001000 O (- 6) 100110
            000000000000 space   000000
            001000001000 W (0 6) 110110
            010000001000 O (- 6) 100110
            010000000001 R (- 9) 101001
            010001000000 L (- 3) 100011
            100000100000 D (+ 4) 010100
    

  3. Background: When the first computers were developed, IBM decided on a 36 bit word, allowing 3 12-bit codes to be packed per word, but this is very inefficient when 6 6-bit codes could handle the kinds of character sets in current use. This led to the development of 6-bit codes. One 6-bit code used for punched-card codes used 2 bits to encode the zone punch and 4 bits to encode the numeric punch. For each block, the zero indicated no punch, while nonzero values in that block indicated which hole was punched, from left to right. For example:
            000000000000 space coded as 000000
            001000000000 0              110000
            000100000000 1              000001
            000000000001 9              001001
            100100000000 A (+ 1)        010001
            100000000001 I (+ 9)        011001
            010000000010 Q (- 8)        101000
            001001000000 T (0 3)        110011
    

    Question: Give the 6-bit encoding for "HELLO WORLD" (not including the quotes).

    See right column in answer to the previous question, but here are some notes on how this was derived, since several students had questions about this:

    Take, for example, the letter E. The 12-bit punched card code is:

            100000010000 E (+ 5)
    

    This can be broken into 2 fields, the zone and numeric fields:

            100 000010000
    

    Bit 1 of the zone field is punched, and bit 5 of the numeric field is punched, so the 2 and 4 bit compact encodings of these two fields are:

            01 0101
    

    Putting this together, we get the 6-bit code for E:

            010101
    

  4. A Problem: Give the 7-bit ASCII representation of the text "= CS:2630 =" Don't include the quotes.
            0111101 =
            0100000 space
            1000011 C
            1010011 S
            0111010 :
            0110010 2
            0110110 6
            0110011 3
            0110000 0
            0100000 space
            0111101 =