CS1021 Tutorial 1
DON’T USE A PROGRAMMER CALCULATOR TO ANSWER THESE QUESTIONS
Q1 Convert the following 8 bit unsigned binary numbers to decimal (i) 011010012 (ii) 10000002 and (iii) 111111112.
(i) 105 (ii) 128 (iii) 255
Q2 Convert the following decimal numbers to 8 bit unsigned binary numbers (i) 79 (ii) 44 and (iii) 126.
(i) 010011112 (ii) 001011002 (iii) 011111102
Q3 Convert the following 8 bit signed binary numbers to decimal (i) 011010012 (ii) 100101102 and (iii) 111100002.
(i) 105 (ii) -106 (iii) -16
Q4 Convert the following decimal numbers to 8 bit signed binary numbers (i) 79 (ii) -44 and -126.
(i) 010011112 0x4F (ii) 110101002 0xD4 (iii) 100000102 0x82
Q5 Convert the following 8 bit binary numbers to hexadecimal (i) 011011012 (ii) 101100002 and (iii) 101011112.
(i) 0x6D (ii) 0xB0 (iii) 0xAF
Q6 Convert the following hexadecimal numbers to 16 bit binary numbers (i) 0xCAFE (ii) 0xFADE and (iii) 0xBEEF.
(i) 11001010111111102 (ii) 11111010110111102 (iii) 10111110111011112
Q7 Convert the following decimal numbers to 16 bit unsigned hexadecimal numbers (i) 51,966 (ii) 64,222 and (iii) 48,879
(i) 0xCAFE(ii) 0xFADE (iii) 0xBEEF
Q8 Convert the following 16 bit unsigned hexadecimal numbers to decimal (i) 0xABCD (ii) 0xF000 and (iii) 0x0FFF
(i) 43,981 (ii) 61,440 (iii) 4095
Q9 Convert the following 16 bit signed hexadecimal numbers to decimal (i) 0xABCD (ii) 0xF000 and (iii) 0x0FFF.
(i) -21,555 (ii) -4096 (iii) 4095
CS1021 Tutorial 1 2018 jones@scss.tcd.ie
1
Q10 Calculate and convert the hexadecimal numbers and answers to decimal assuming 16 bit unsigned and signed integers (i) 0x1234 + 0xAAAA (ii) 0x468A + 0xAAAA (iii) 0xAAAA – 0x1234 and (iv) 0x8AAA – 0x6BBB
0x1234
+ 0xAAAA 0xBCDE
0x468A
+ 0xAAAA 0xF134
0xAAAA
– 0x1234 0xBCDE
0x8AAA
– 0x6BBB 0x1EEF
unsigned
4,660
43,690
48,350
unsigned
18,058
43,690
61,748
unsigned
43,690
4,660
48,350
unsigned
35,498
25,579
-17,357
signed
4,660
-21,846
-17,186
signed
18,058
-21,846
-3,788
signed
-21,846
4,660
-17,186
signed
-30,038
-27,579
-7,919
CS1021 Tutorial 1 2018 jones@scss.tcd.ie
Q11 Convert the following unsigned binary numbers to decimal (i) 1010.001012 and (ii) 0.10012.
(i) 10.15625 (ii) 0.5625
2