logo

Computers, Data and Programming - Assignment 1

   

Added on  2023-01-16

9 Pages2055 Words2 Views
 | 
 | 
 | 
Assignment 1
Computers, data and programming
ITC544
Student Name
Student numebr
Computers, Data and Programming - Assignment 1_1

Question 1.
a) Determine the value of base b if (152)b = 0x6A. Please show all steps. [3 marks]
b^2 * 1 + b^1 *5 + b^0 *2 = b2 + 5b + 2
0x6A = 16^1 *6 + 16^0*10 = 96 + 10 = 106d
Comparing two sides
b2 + 5b + 2 = 106
solving equation gives
b2 + 5b + -104 = 0
(b - 8) (b + 13) = 0
b = 8 or b = 13
b is base and cannot be –ve so Base b = 8
b) Convert the followings: (Please show all steps; no marks will be awarded if no steps are
shown) [1.5x4 = 6 marks]
i) 0xBAD into 3-base representation
0xBAD = B * 16^2 + A*16^1 + D *16^0
= 11 * 256 + 10 * 16 + 13 * 1
= 2989
Conversion to Base 3
2989/3 = 996 R 1
996/3 = 332 R 0
332/3 = 110 R 2
110/3 = 36 R 2
36/3 = 12 R 0
12 / 3 = 4 R 0
4 / 3 = 1 R 1
1 / 3 = 0 R 1
Then 0xBAD = 110022013
ii) 3217 into 2-base (binary) representation
3217 /2 = 1608 R 1
1608/2 = 804 R 0
804/2 = 402 R 0
402/2 = 201 R 0
Page 2 of 9
Computers, Data and Programming - Assignment 1_2

201/2 = 100 R 1
100/2 = 50 R 0
50/2 = 25 R 0
25/2 = 12 R 1
12/2 = 6 R 0
6/2 = 3 R 0
3/2 = 1 R 1
1 / 2 = 0 R 1
3217 = 110010010001b
iii) 1235 into octal representation
1235 / 8 = 154 R 3
154 / 8 = 19 R 2
19 / 8 = 2 R 3
8 / 3 = 0 R 2
1235 = 23238
iv) 21.218 into decimal representation
21.218 = 21.218 * 1000 / 1000
= 21218 / 1000
c) Given a (very) tiny computer that has a word size of 3 bits, what are the lowest value
(negative number) and the highest value (positive number) that this computer can represent in
each of the following representations? [3 marks]
i) One's complement
Highest Positive Value = 2(N-1) -1 = 2(3-1) -1 = 22 -1 = + 3
Highest Negative Value = -(2(N-1) -1) = - (2(3-1) -1) = -(22 -1) = - 3
ii) Two's complement
Highest Positive Value = 2(N-1) -1 = 2(3-1) -1 = 22 -1 = + 3
Highest Negative Value = -(2(N-1)) = - (2(3-1)) = -(22 ) = - 4
iii) Signed Magnitude
Highest Positive Value = 2(N-1) -1 = 2(3-1) -1 = 22 -1 = + 3
Highest Negative Value = -(2(N-1) -1) = - (2(3-1) -1) = -(22 -1) = - 3
Page 3 of 9
Computers, Data and Programming - Assignment 1_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents