Homework 2 Information, ECS50 Summer 2007

  • Written homework due by 5PM on Monday, August 25th
  • Programs due by 11:59PM on Monday, August 25th
  • Do all problems.

    Assignment:

    (1) Problem 4.1 (a,c,d,e,f)
    (2) Problem 4.2
    (3) Problem 4.5
    (4) Problem 4.6 (a)
    (5) Problem 4.7 (a)
    (6) Problem 4.13 (program) with the following modification:  You are *not* 
    				to use the OV flag.  Find another way.
    (7) Problem 3.8 (program) with the following modification:  use odd parity
    (8) Problem 5.2
    (9) Problem 5.3
    
    (10) Create a program that reverses the elements of an array. 
    Initially, define the array as follows:
    
    ARRAY:	.BLKW	10
    
    First you will ask the user how many 
    elements are in the array (could be <= 10), then 
    you will input each of those numbers and store them 
    into the array. If the user enters a size bigger 
    than 10, output an error message and prompt for 
    the size again.  Once all the numbers have been 
    read in, you will reverse the elements and print 
    out the array. Your program terminates when the 
    user enters 0 for the array size, otherwise it 
    keeps on going.
    
    Here's a sample run:
    
    :Enter size of array (max 10) >> 30
    :invalid size!
    :Enter size of array (max 10) >> 3
    :10
    :8
    :15
    :The array in reverse order is >>
    :15
    :8
    :10
    :Enter size of array (max 10) >> 2
    :40
    :20
    :The array in reverse order is >>
    :20
    :40
    :Enter size of array (max 10) >> 0
    :bye!
    
    Your program has to modify the array by
    actually swapping elements (i.e. don't just
    print out the array from the end to the front).
    
    (11) Problem 6.1 (d), (e), (f), (f), (g) (not a misprint! :-)
    (12) Problem 6.2
    (13) Problem 6.3
    (14) Problem 6.5
    (15) Problem 6.7 using the following calls:
    
    	procedure Michael(a:integer; b:integer_array)
    	function Phelps(c,d: integer; e,f:integer_array; var g:integer):integer;
    
    (16) Problem 6.8 using above information
    (17) Problem 6.9 using above information
    (18) Problem 6.12 (program), with the following modifications:
    
            Instead of working with addressing modes, work with opcodes.  There are
    	9 different types of instructions (data transfer, arithmetic,
    	comparison, etc.)  Calculate a histogram of the different types of 
    	operand instructions (you can ignore the operate ones).
    
    (19) Problem 7.4  (program)
    
    (20) Problem 8.1 (c), (g), (h), (d), (e), (f) 
    (21) Problem 8.3
    (22) Problem 8.4 
    (23) Problem 8.7
    (24) Problem 8.10 
    (25) Problem 8.13 (The solution to Problem 8.8 is provided on the CUSP disk)