#### Computer and Data programming for IOT

**Question 1.**

a) A Computer uses IEEE-754 single precision format to represent floating points. What value (in decimal) the computer represents if the floating point is represented using the following binary digits. Show all the steps used in finding the answer. [3 marks]

0 01111110 10100000000000000000000

b) Convert the following numbers. (Please show all steps; no marks will be awarded if no steps are shown) [1.5 x 4 = 6 marks]

i) 0xAD9 into 3-base representation

ii) 451_{8} into 2-base (binary) representation

iii) 123.3_{5} into octal representation (up to 3 octal points)

iv) 14.35_{8} into decimal representation

**Answer**** 0.8125**

**Explanation:**

0 01111110 10100000000000000000000

Sign bit is 0

Exponent is 01111110 => E = 126

So the answer is 1.10100000000000000000000 x 2^{E – 127=>} 1.10100000000000000000000 x 2 ^{126 – 127=>} 1.10100000000000000000000 x 2 ^{-1}

Converting 1.101 to decimal we get

=> 1 x 2^{0} + 1 x 2^{-1} + 0 x 2^{-2} + 1 x 2^{-3} => 1 + 0.5 + 0.125 => 1.625**So its 1.625 x 2 ^{-1} => 1.625/2 => 0.8125**

**b)**

**i) 0xAD9 into 3-base representation**

Converting to base 10 we get

=> 10 x 16^{2} + 13 x 16^{1} + 9 x 16^{0} = 2777

Converting to base 10 we get =>

2777/3 => 925 with remainder 2

925/3 => 308 with remainder 1

308/3 => 102 with remainder 2

102/3 => 34 with remainder 0

34/3 => 11 with remainder 1

11/3 => 3 with remainder 2

3/3 => 1 with remainder 0

1/3 => 0 with remainder 1**Hence the Answer is —– > 10210212**

ii) 451_{8} into 2-base (binary) representation

=> Octal is taken in pair of 3 bits , Writing binary of each number in 3 bits we get**=> 100 101 001 in BASE 2**

iii) 123.3_{5} into octal representation (up to 3 octal points) => **46.4631**

=> 1 x 5^{2} + 2 x 5^{1} + 3 x 5^{0} + 3 x 5^{-1} **=> 38.6 in decimalConverting to Octal we get38 /8 => 4 with remainder 64 /8 => 0 with remainder 4.6 x 8 => 4.8.8 x 8 => 6.4….46.4631**

iv) 14.35_{8} into decimal representation

=> 1x 8^{1} + 4 x 8^{0} + 3 x 8^{-1} + 5 x 8^{-2} **=> 12.453125**

**Assignment 1: Computers, data and
programming**

**Value:** 15%

**Due Date:** 06-Sep-2019

**Return Date:** 01-Oct-2019

**Length:**

**Submission method options:** Alternative submission method

**Task**

**Total marks: 30**

Answer the following Questions

**Question 1. **

a) A Computer uses IEEE-754 single precision format to represent floating points. What value (in decimal) the computer represents if the floating point is represented using the following binary digits. Show all the steps used in finding the answer.

[3 marks]

0 01111110 10100000000000000000000

b) Convert the following numbers. (Please show all steps; no marks will be awarded if no steps are shown)

[1.5 x 4 = 6 marks]

i) 0xAD9 into 3-base representation

ii) 451_{8} into 2-base
(binary) representation

iii) 123.3_{5} into octal
representation (up to 3 octal points)

iv) 14.35_{8} into
decimal representation

**Question 2. **

Write a MARIE program that accepts an integer from the user, and if it is a prime number the program will output 1, otherwise, the program will output 0.

Examples:

If the user input is 17, the output would be 1

If the user input is 2, the output would be 1

If the user input is 15, the output would be 0

If the user input is -2, the output would be 0

You should write and run the program using MARIE simulator. Add enough comments to understand your code.

You do not have to include the .mas file in the submission. Instead, the code should be presented as a word-processed section in the assignment, not as an image.

Insert images to show you have tested the code with several possibilities.

[10 marks]

**Question 3.**

a) Explain with an example of what is meant by high-order interleaving and low-order interleaving in memory organisation.

[3 marks]

b) Suppose we have a memory consisting of 32 4Kx8-bit chips.

Show the address structure and module organisation when

i. high-order interleaving is used

ii. low-order interleaving is used.

[8 marks]

**Rationale**

This assessment task will assess the following learning outcome/s:

- be able to investigate and describe the essential elements of a computer and their functionalities.
- be able to apply an understanding of data representations and calculations to practical situations.
- be able to develop an elementary computer program.