Practice Questions for “representing things with binary quantities”:

 

1. Decimal from/to binary:

 

a. Convert the following decimal numbers to 8-bit binary:

 

67

 

156

 

-36

 

Double-check your results by converting back to decimal.

 

b. Convert the following binary numbers to decimals assuming the numbers are unsigned:

 

0010 1101

 

1001 1001

 

c. Repeat for the preceding two numbers assuming that the numbers are signed in 2’s complement

 

 

2. Hexadecimal

 

a. Convert 0xdabc1fe2 to binary

 

b. Write 001 0100 1101 in hexadecimal

 

c. Convert -2 (in decimal) into a 16-bit binary number in 2’s complement and then write the 2’s complement’s representation in hexadecimal.

 

3. Floating point

 

a. Convert 128.128 into the 32-bit IEEE floating point representation.

 

b. Write a C program that demonstrates that not all decimal numbers can be exactly represented using the 32-bit IEEE floating point representation. Use 37.64 as your decimal number. Store it in a floating point number and then print it out.

 

4. Arbitrary Numerical Representation

 

Design a digital circuit that adds two two-bit numbers and produces their two-bit sum (the adder does addition modulo 3) assuming the following representation of numbers:

 

0 -> 00

1 -> 10

2 -> 11

3 -> 01

 

Provide the truth table for this circuit. It accepts two 2-bit inputs and produces one 2-bit output.