Computer Science 161.01

Fall 2018

Professor Valente

 

Homework 1: 50 points

Due Wednesday September 5th  at class time!

 

YOU MAY WORK WITH A PARTNER BUT PLEASE SUBMIT YOUR OWN.

 

 

YOUR NAME: _____________________________________________________________________

 

1. 2 points Do page 72 exercises #28 and #32.

For #32, your answer should be the least number of bits needed to represent all the possible grades.

 

2. 6 points Convert the following 12-bit patterns to a 3-digit hexadecimal pattern:

   a)  001011110000 ________________       b)  101001001101 _____________

 

3. 9 points Convert each of the following hexadecimal patterns to a 12-bit pattern:

   a)  x120        _________________________________     

   b)  xA34       _________________________________

   c)  x67F        _________________________________     

 

4. 10 points  Use the ASCII table to decode the following message (it is in hex).

 

54 68 65 20 63 6C 61 73 73 20 6F 66 20 32 30 32 31 20 72 6F 63 6B 73 21

 

You should check your answer with my text conversion web site.

 

Your answer must be exactly correct, so when you write it down, you must list upper and lower case letters exactly where they should appear, as well as punctuation and spaces.


 

 

5. 8 points Type in the following program into the VSC-32 computer, then Assemble it and Load it. 

(You need to delete the words “Assembly Language”, then type carefully what you see below,  remembering to press the Enter key after each line including the last.)  Once the program is loaded, list below in hexadecimal the contents of Main Memory. 

Remember that each byte is represented by two hexadecimal digits.

 

            load x

add y

      store z

      write z

      stop

      x:data 25

      y:data 32

      z:data 0

 

 

6. 7 points  The following is a VSC-32 program, except that it uses hexadecimal as a shorthand.  Thus, every pair of hex digits represents an 8-bit binary instruction.  Expand the program into binary and write the binary below.  

 

67 27 A6 48 88 00 01

 

 

 

 

 

Now enter the binary carefully at this site by typing each 8-bit pattern on a separate line.

Then press the Load And Go button to run the program. 

What does the program appear to do when you enter an integer in response to the prompt?

 

In order to answer this question, you should run the program repeatedly, but you should click the Reset Registers button prior to each run.

 


 

 

 

 

 

7. 8 points  Use the GCD web page to Step through the algorithm as it computes the greatest common divisor of 2040 and 210.  Remember to enter 2040 and 210 in the boxes at the top of the page where it asks for first number and second number.

 

Record below the succession of values for I, J, and R, and afterwards the result.  I’ve already recorded what you will see after pressing Step the first time.

 

I   2040

J     210

R