$24
PART 1 (Submit to moodle / .py file)
Write a python code that:
1. Assigns two numbers to two variables.
2. Prints their values.
3. Switches their values. (Use a temporal variable.)
4. Prints their values.
Explain what happens in each line of code writing comments.
PART 2 (Submit to moodle / .doc file)
Research IEEE 32 and 64 bits floating point format. Answer the following questions according to IEEE 32 bits floating point format. Write detailed explanations of your answers.
1. Convert decimal 0.0098 to binary representation.
2. Convert binary 11000001011100000000000000000000 to decimal.
PART 3 (Submit to moodle / .doc file)
Remember that an algorithm is a set of steps that defines how a task is performed. Your task is sorting numbers. Write an algorithm that sorts an unsorted sequence of numbers ascending. The algorithm creates a new sorted sequence. The new place of an element X in the sorted sequence is decided by counting the number of elements come before element X in the sorted sequence. For instance, if our unsorted sequence is (9 1 2 8 3 5), the place of 5 in the sorted sequence should be 4. Write your steps clearly.
PART 4 (Submit to TA as hardcopy written by hand)
1. Solve each of the following problems in two’s complement notation. Watch for overflow and indicate which answers are incorrect because of this phenomenon.
a. 0100 + 0011 b. 0101 + 0110 c. 1010 + 1010 d. 1010 + 0111 e. 0111 + 0001
2. Convert each of the following binary representations into its equivalent base ten representation:
a. 11.11 b. 100.0101 c. 0.1101 d. 1.0 e. 10.01