EECS 31/CSE 31/ICS 151 Homework 1 Questions with Solutions

View Questions Only
View Questions with Strategies

Problem 1

Question

(Number conversion) Give the binary equivalents of the following hexadecimal numbers.

  1. 123.45
  2. 1000.50
  3. BAD.CAB
  4. DA7.35C

Solution

  1. 1 0010 0011.0100 0101
  2. 1 0000 0000 0000.0101
  3. 1011 1010 1101.1100 1010 1011
  4. 1101 1010 0111.0011 0101 11

Problem 2

Question

(Number conversion) Find the decimal equivalents of the following radix-7 numbers.

  1. 606
  2. 123
  3. 6650
  4. 345.6

Solution

  1. 300
  2. 66
  3. 2387
  4. 180.86

Problem 3

Question

(Addition rules) Add the following numbers without converting them to decimal representations.

  1. 01110(binary) and 110011(binary)
  2. 98A(base 12) and 234 (base 12)
  3. ABC(Hexadecimal) and A78(Hexadecimal)

Solution

  1. 1000001
  2. 1002
  3. 1534

Problem 4

Question

(Subtraction rules) Perform binary subtraction by taking the two's complement of the subtrahend.

  1. 101110-10001
  2. 111111-11110
  3. 11110-1001
  4. 100001-10001

Solution

  1. 11101
  2. 100001
  3. 10101
  4. 10000

Problem 5

Question

(Multiplication rules) Perform binary multiplication with the following two's complement numbers.

  1. 011011 * 0011

Solution

  1. 1010001

Problem 6

Question

(Division rules) Divide the following binary numbers.

  1. 11011/1001

Solution

  1. 11

Problem 7

Question

(Division algorithms) Define the procedure and draw the flowchart for the division of:

  1. Sign-magnitude binary numbers.

Solution

  1. signed division:
    Signed Division Figure
  2. Perform unsigned division on magnitudes
    Unsigned Division Figure

Problem 8

Question

(Floating-point algorithms) Define the procedure for:

  1. adding
  2. multiplying

Solution

  1. adding: (change the second'shift>0?'(lower one) to ' MantA>=MantB?')
    Adding Figure
  2. multiplying:
    Multiplying Figure