## CS 255 - Computer Organization/Architecture I Homework Assignment 1

Due date: See Class Webpage

## 1. 2's Complement Encoding (20 pts)

A computer X uses 2-bytes to store the values in this question. Furthermore, the computer uses the 2's complement number system to represent signed numbers.

Each question is 5 pts.

 What are the 2's complement representation for the values 4317(10) and −4317(10) in computer X ? What decimal values are represented by the following patterns in computer X ? ``` Pattern 1: 0000 0010 0100 0101 Pattern 2: 1111 0001 0101 0111 ``` Give the binary pattern that results from adding the two patterns in part 2. What value is represented by this pattern ? Give the binary pattern that results from subtracting the pattern 1 from pattern 2 in part 2. What value is represented by this pattern ?

## 2. 10's Complement Encoding (20 pts)

Consider the 10's complement encoding scheme using 4 digits.

Each question is 5 pts.

 What are the 10's complement representation for the value 3429 and −3429 ? What value is represented by 8896 ? Add the representations 9765 and 9995. (Truncate the result to 4 digits !) What value is represented by the result ? Did the addition resulted in the correct value ? Multiply the representations 9765 and 9995. (Truncate the result to 4 digits !) What value is represented by the result ? Did the multiplication resulted in the correct value ?

## 3. Binary Arithmetic (10 pts)

Do the following arithmetic computations in binary.

1. 11110101 x 1101

Show the complete tail multiplication to get full credit

2. 11110101 / 1101

Show the give complete division to get full credit

## 4. Base-5 Arithmetic (10 pts)

Do the following arithmetic in base-5.

(1432)5 x (2414)5

give complete "tail" multiplication to get full credit.

## 5. Octal, Hexadecimal and Other Numbers (20 pts)

1. Give the representation of the value 4539 in the octal number system (that is based on the number 8).

2. Give the representation of the value 4539 in the hexadecimal number system (that is based on the number 16).

3. Give the representation of the value 4539 in the "nano number system" (that is based on the number 9).

4. Give the representation of the value 4539 in the "13 number system" (that is based on the number 13; use A to represent 10, B for 11 and C for 12).

## 6. Encoding (20 pts)

Show the binary representation (in bits) for the following data items when they are stored in computer memory:

 The string "Huh?" The string "x=52;" The pattern stored in a byte typed variable by the statement x=52; The string "x=0;" The pattern stored in an int typed variable by the statement x=0; The octal number 123057 The hexadecimal number BAD4 The single precision float point number 4.0 in IEEE 754 representation The single precision float point number 7.75 in IEEE 754 representation What is the float point number (written in decimal) represented by the following IEEE 754 representation:           11000001010001000000000000000000

• Extension request

• To request an extension for hw1, you must execute the following command before the deadline of the homework (for paper homework, the deadline is the start time of the class):

 ``` /home/cs255001/req-ext hw1 ```

You request will be successful if you have not exceeded the maximum number of "free" (no-questions-asked) requests allowed

## Statement of Policy on Homework Assignments

Students will be graded partially on the basis of their homework assignments. These homework assignments are to be treated as examinations, and are expected to be your individual work. While discussions with other students in the course may be permitted or encouraged by your instructor, you should write your program yourself. Your instructor (and any teaching assistants assigned to the course) will be glad to help you to the extent that he or she feels reasonable.

Submissions based on other students solutions in prior offerings of the course specifically violate these guidelines, as do submissions prepared with the help of an outside "tutor".

You should take precautions to protect the confidentiality of your work, do not collaborate on questions that you turn in for a grade, do not show your solution to a fellow student, not even after the due date for some students may have receive extension.

All submissions should include a comment statement near the top of the program of the form:

THIS CODE IS MY OWN WORK, IT WAS WRITTEN WITHOUT CONSULTING A TUTOR OR CODE WRITTEN BY OTHER STUDENTS - your name

Cases of apparent plagiarism or collusion will be referred to the Honor Council.