Lab 1 worksheet[ 1341] - weekly assignment PDF

Title Lab 1 worksheet[ 1341] - weekly assignment
Author Arenevian
Course Introduction to Computer Science
Institution Langara College
Pages 9
File Size 72.2 KB
File Type PDF
Total Downloads 38
Total Views 150

Summary

weekly assignment...


Description

Lab 1: Number Systems, Fractions, ASCII Angus Angell [100 marks total]

1. [3 marks] Convert 2013 to decimal. Show the full polynomial first. You can verify your final result using the “Conversions Between Bases” applet. Q 201 20 2

R 20 2

1x1 0x3 2x9

= 19

201 base 3 = 19 base 10

2. [5 marks] Convert 20110 to base 5. Show the quotient and remainder at each step of the division algorithm. You can verify your final result using the “Conversions Between Bases” applet.

Q 201 40 8 1

R 40 8 1

1x1 0x10 3x100 1x1000

= 1301

201 base 10 = 1301 base 5

3. [3 marks] Convert 3526 to decimal. Show the full polynomial first.

Q 352 35 3

R 35 3

2x1 5x6 = 140 3x36

352 base 6 = 140 base 10

Page 1

4. [5 marks] Convert 35210 to base 8. Show the quotient and remainder at each step of the division algorithm.

Q 352 44 5

R 44 5

0x1 4x10 5x100

= 540

352 base 10 = 540 base 8

5. [5 marks] Convert 21510 to binary. Show the quotient and remainder at each step of the division algorithm.

Q 215 107 53 26 13 6 3 1

R 107 53 26 13 6 3 1 0

1 1 1 0 1 0 1 1

215 base 10 = 11010111 base 2

6. [3 marks] Convert 1011001102 to decimal. Show the full polynomial first. 1x2^8 + 0x2^7 + 1x2^6 + 1x2^5 + 0x2^4 + 0x2^3 + 0x2^3 + 1x2^2 + 1x2^1 + 0x2^0 = 358 101100110 in base 2 = 358 base 10

Page 2

7. [3 marks] Convert 1011001102 to octal using bit grouping. 101 = 5 100 = 4 110 = 6

101100110 base 2 = 546 base 8

8. [3 marks] Convert 1011001102 to hexadecimal using bit grouping. 1011 = B 0011 = 3 0000 = 0

101100110 base 2 = B30 base 16

9. [5 marks] Convert 76458 to hexadecimal; convert to binary first by ungrouping the octal digits and then to hexadecimal by bit grouping. Octal: 111 = 7 110 = 6 100 = 4 101 = 5

Hex: 1111 = F 1010 = A 0101 = 5

7645 base 8 = FA5 base 16

10. [5 marks] Convert F010ED16 to octal. 111 = 7 100 = 4 000 = 0 001 = 1 000 = 0 011 = 3 101 = 5 101 = 5

F010ED base 16 = 74010355 base 8

Page 3

11. [5 marks] Perform the direct binary addition of 010111012 and 001101012. In addition to the final result, be sure to show the sequence of carry bits. 11111

1

01011101 00110101 +_____________ 10010010

= 10010010 base 2

12. [5 marks] Perform the direct octal addition of 7768 and 5438. In addition to the final result, be sure to show the sequence of carry bits.

11

776 543 +_____ 1541

= 1541 base 8

13. [5 marks] Perform the direct hexadecimal addition of AB916 and CDF16. In addition to the final result, be sure to show the sequence of carry bits. 11

AB 9 CDF +_____ 1798

= 1798 base 16

Page 4

14. [3 marks] Convert -45 to 8-bit signed magnitude binary notation. 128 64 32 16 8 4 2 1 0 0 1 0 1101

00101101 base 2 = 45 base 10

-45 base 10 = 10101101 base 2 | sign magnitude

15. [4 marks] Convert -45 to 8-bit 2's complement binary notation.

00101101 base 2 = 45 base 10 -45 base 10 = 11010011 base 2 | 2’s compliment

Page 5

16. [9 marks] Convert the following 8-bit signed magnitude binary numbers to decimal. 10101010 00101010 = 45 32 + 8 + 2 = 45 10101010 = -45 ----------------------------------------------------00110101 00110101 = 53 32 + 16 + 4 + 1 = 53

-----------------------------------------------------11110100 01110100 64 + 32 + 16 + 4 = 116 11110100 = -116

17. [9 marks] Convert the following 8-bit 2's complement binary numbers to decimal. ---------------------------------------------------10101110 1

11010001 1 +________ 11010010

= - 82

----------------------------------------------------00110101 0×2⁷+ 0×2⁶+ 1×2⁵+ 1×2⁴+ 0×2³ + 1×2² + 0×2¹ + 1×2⁰= 53

Page 6

(check next page) 17. continued ---------------------------------------------------11101010 1

10010101 1 +_______ 10010110

= -22

Page 7

18. [5 marks] Convert the decimal 27.137 to binary. Stop after 5 binary digits to the right of the decimal point.

Q 27 13 6 3 1 0

R 1 1 0 1 1

= 11011.

.137x2 = 0.274 .274x2 = 0.548 .548x2 = 1.096 .096x2 = 0.192 .192x2 = 0.384

= .00100

27.137 base 10 = 11011.00100 base 2

19. [5 marks] Convert the binary 1111.0011 to a decimal number (with fraction). Show the full polynomial first.

(1x2^3 + 1x2^2 + 1x2^1 + 1x2^0) = 15 (0x2^-1 + 0x2^-2 + 1x2^-3 + 1x2^-4) = 0.1875 1111.0011 base 2 = 15.1875 base 10

Page 8

20. [5 marks] What is your name in ASCII codes (use hexadecimal).

41 6E 67 75 73 Angus

21. [5 marks] Decode the following ASCII coded phrase (these are the decimal numbers for each ASCII character). 67 111 110 118 101 114 116 105 110 103 32 102 114 111 109 32 65 83 67 73 73 32 99 111 100 101 115 32 116 111 32 116 101 120 116 32 105 115 32 102 117 110 46 32 40 78 79 84 33 41 Converting from ASCII codes to text is fun. (NOT!)

Page 9...


Similar Free PDFs