logo

Assignment 1: Computers, Data and Programming

   

Added on  2023-02-01

6 Pages1387 Words85 Views
 | 
 | 
 | 
Assignment 1: Computers, Data and Programming
Student ID:
Student Name:
Subject Code: ITC544
Page 1 of 6
Assignment 1: Computers, Data and Programming_1

Solution
Question 1.
a) Convert 152b into decimal:
152b=1*b2 + 5*b1 + 2*b0 = (b2 + 5b + 2)10
Convert 0x6A16 into decimal:
6A16=6*161 + 10*160 = 96 + 10 = 10610
Since,
152b = 6A16
(b2 + 5b + 2)10= 10610
b2 + 5b – 104 = 0
(b+13) (b-8) = 0
b = -13 or b = 8
Since bases must be positive, the value of b is 8
b)
i) Convert 0xBAD16 into decimal:
BAD16 = B*162 + A*161 + D*160
= 11*162 + 10*161 + 13*160
= 2816 + 160 + 13
= 298910
Convert 298910 into base-3 representation:
Quotient = 2989/3 = 996 Remainder = 2989%3 = 1
Quotient = 996/3 = 332 Remainder = 996%3 = 0
Quotient = 332/3 = 110 Remainder = 332%3 = 2
Quotient = 110/3 = 36 Remainder = 110%3 = 2
Quotient = 36/3 = 12 Remainder = 36%3 = 0
Quotient = 12/3 = 4 Remainder = 12%3 = 0
Quotient = 4/3 = 1 Remainder = 4%3 = 1
298910 = 110022013
As 0xBAD16 = 298910 and 298910=110022013,
0xBAD16 =110022013
ii) Convert 3217 to decimal:
3217 = 3*72 + 2*71 + 1*70 = 3*49 + 2*7 + 1*1
= 147+14+1
= 16210
Page 2 of 6
Assignment 1: Computers, Data and Programming_2

Convert 16210 to binary:
Quotient=162/2=81 Remainder=162%2=0
Quotient=81/2=40 Remainder=81%2=1
Quotient=40/2=20 Remainder=40%2=0
Quotient=20/2=10 Remainder=20%2=0
Quotient=10/2=5 Remainder=10%2=0
Quotient=5/2=2 Remainder=5%2=1
Quotient=2/2=1 Remainder=2%2=0
16210 = 101000102
As 3217 = 16210 and 16210 = 101000102,
3217 = 101000102
iii) Convert 1235 into decimal:
1235 = 1*52 + 2*51 + 3*50
= 1*25 + 2*5 + 3*1
= 25 + 10 + 3 = 3810
Convert 3810 to octal:
Quotient=38/8=4 Remainder=38%8=6
3810 = 468
As 1235 = 3810 and 3810 = 468,
1235 = 468
iv) 21.218 = 2*81 + 1*80 + 2*8-1 + 1*8-2 = 16 + 1 +0.25 +0.015625
= 17.26562510
c)
i) One's complement
For n-bit one's complement, the lowest value (negative number) that can be stored is -(2n-1-1) and
the highest value (positive number) that can be stored is +(2n-1-1)
For tiny computer of word size 3 bits, the lowest value (negative number) is -(23-1-1) = -3 and the
highest value (positive number) is +(23-1-1) = +3
ii) Two's complement
For n-bit two’s complement, the lowest value (negative number) that can be stored is -(2n-1) and
the highest value (positive number) that can be stored is +(2n-1-1)
For tiny computer of word size 3 bits, the lowest value (negative number) is -(23-1) = -4 and the
highest value (positive number) is +(23-1 - 1) = +3
iii) Signed Magnitude
For n-bit signed magnitude, the lowest value (negative number) that can be stored is -(2n-1-1) and
the highest value (positive number) that can be stored is +(2n-1-1)
For tiny computer of word size 3 bits, the lowest value (negative number) is -(23-1-1) = -3 and the
highest value (positive number) is +(23-1-1) = +3
Question 2.
Page 3 of 6
Assignment 1: Computers, Data and Programming_3

End of preview

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

Related Documents