Lecture notes for the Introduction to Computer Science I by James Tam Return to the course web page

CPSC 231: Assignment 2 (Worth 2%)

Score out of 40 Letter grade Score out of 40 Letter grade
39 - 40 A 27 - 28 C
37 - 38 A- 25 - 26 C-
35 - 36 B+ 23 - 24 D+
33 - 34 B 21 - 22 D
31 - 32 B- 19 - 20 D-
29 - 30 C+  Less than 19 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. 0101002 (binary) to octal

 

 

 

         Answer:

 

  1. 01010011002 (binary) to hexadecimal

 

 

 

          Answer:

 

  1. 4816 (hexadecimal) to octal

 

 

        Answer:

 

  1. 3910 (decimal) to hexadecimal

 

 

        Answer:

 

  1. 19.2510 (decimal) to binary

 

 

        Answer:

 

  1. 456.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   10110   11000
  +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 010100    
Second example   100101  
Third example     111111

 

Part IV: Non-decimal based (10 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
- 210
Show your work here:

 

 

 

Answer (Ones complement):

Answer (Binary):

Answer (Decimal):

 

  Two's complement  approach
         
  310
- 510

Show your work here:

 

 

 

Answer (Twos complement):

Answer (Binary):

Answer (Decimal):

 

 

 

Part V: Logic (6 marks)

  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 F F T T 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