Lecture notes for the Introduction to Computer Science for non-majors by James Tam Return to the course web page

CPSC 217: Assignment 2 (Worth 6%)

Scoring

Score 50-51 48-49 44-47 40-43 36-39 31-35 27-30 23-26 18-22 13-17 8-12 0-7
Letter A A- B+ B B- C+ C C- D+ D D- F

New Concepts to be applied for the assignment

Part I: Number conversions (12 marks: Half marks for the answer, half marks for showing your work)

  1. 1010102 (binary) to octal

 

 

 

         Answer:

 

  1. 11010010002 (binary) to hexadecimal

 

 

 

          Answer:

 

  1. 5816 (hexadecimal) to octal

 

 

 

        Answer:

 

  1. 2910 (decimal) to hexadecimal

 

 

 

        Answer:

 

  1. 10.2510 (decimal) to binary

 

 

 

        Answer:

 

  1. 176.48 (octal) to decimal

 

 

 

        Answer:

 

Part II: Non-decimal based math (6 marks: Half marks for the answer, half marks for showing your work)

Perform the following binary additions and subtractions (using regular base two subtraction employing a borrow if necessary) and not by using complements.

   11110   10100   10000
  +11010   -01010   -00010
Binary result          

Part III: Complements (6 marks: 1 mark for each empty cell).

Perform the necessary conversions in order to fill in the missing values in the table below.

Number system

 

Original binary value

Ones complement value

Twos complement value

First example 010010    
Second example   100111  
Third example     111111

Part IV: Non-decimal based (15 marks: For each conversion 1 mark for the binary value, 1 mark for the value as the appropriate complement, 1 mark for the decimal value, 2 marks for showing your work).

Perform the following subtractions via the complement and add technique using 4 bits.                         

  One's complement approach   
         
  710
- 510
Show your work here:

 

Answer (Ones complement):

Answer (Binary):

Answer (Decimal):

 

 

  One's complement approach   
         
  -510
  -510
Show your work here:

 

Answer (Ones complement):

Answer (Binary):

Answer (Decimal):

 

  Two's complement  approach
         
  310
- 410

Show your work here:

 

 

Answer (Twos complement):

Answer (Binary):

Answer (Decimal):

 

 

Part V: Floating point (6 marks for the correct mantissa and exponent values)

For this part of the assignment you are to assume that the computer will store real numbers in floating point form. The computer can store up to 5 digits for the mantissa and 2 digits for the exponent. Based on the input you are to determine what will be stored in the mantissa and the exponent.
     
Number input Mantissa Exponent
63851    
1050    
645367    

 

Part VI: Logic (6 marks for the correct answer)

  T F T F F
AND F F T T F
           
           
  T F T F F
OR F F T T F
           
           
  T F T F F
XOR T F T F F
           
           
  T F T F F
NOT          
           
  T F T F F
NAND F F T T F
           
           
  T F T F F
NOR F F T T F
           

As a reminder, you are not allowed to work in groups for this class.   Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following link