0% found this document useful (0 votes)
10 views3 pages

Lab 01

The document outlines a lab exercise for a computer science class, focusing on converting decimal numbers to binary and hexadecimal formats. It includes exercises with scoring scales and provides various examples of conversions and calculations. The lab aims to enhance students' understanding of number systems in computer science.

Uploaded by

dp123235
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Lab 01

The document outlines a lab exercise for a computer science class, focusing on converting decimal numbers to binary and hexadecimal formats. It includes exercises with scoring scales and provides various examples of conversions and calculations. The lab aims to enhance students' understanding of number systems in computer science.

Uploaded by

dp123235
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

STUDENT : PHẠM THỊ MỸ DUYÊN – MSSV: QE180145

CLASS : SE18C02

CSI104: Foundations Of Computer Science

Duration: 90’

Lab 1:

Scoring scale: 10

Exercise 1 (2.5 marks): Convert decimal numbers to binary ones

Decimal 4-bit Decimal 8-bit Decimal 16-bit Binary


Binary Binary

9 1001 7 0000 0111 255 0000 0000 0001 1001


7 0111 34 0010 0010 192 0000 0000 1100 0000
2 0010 125 0111 1101 188 0000 0000 1011 1100
15 1111 157 1001 1101 312 0000 0001 0011 1000
12 1100 162 1010 0010 517 0000 0010 0000 0000
11 1011 37 0010 0101 264 0000 0001 0000 1000
6 0110 66 0100 0010 543 0000 0010 0001 1111
5 0101 77 0100 1101 819 0000 0011 0011 0011
8 1000 88 0101 1000 1027 0000 0100 0000 0011
13 1101 99 0110 0011 2055 0000 1000 0000 0111
14 1110 109 0110 1101 63 0000 0000 0011 1111

Exercise 2 (2.5marks): Convert decimal numbers to binary and hexadecimal ones

Decimal Binary Hexa. Decimal 16-bit Binary Hexadecim


al
9 1001 9 255 0000 0000 1111 1111 00FF
127 0111 1111 7F 192 0000 0000 1100 0000 00C0

125 0111 1101 7D 188 0000 0000 1011 1100 BC

157 1001 1101 9D 312 0000 0001 0011 1000 0138

162 1010 0010 A2 517 0000 0010 0000 0101 0205

37 0010 0101 25 264 0000 0001 0000 1000 0108

66 0100 0010 42 543 0000 0010 0001 1111 021F

77 0100 1101 4D 819 0000 0011 0011 0011 0333

88 0101 1000 58 1027 0000 0100 0000 0011 0403

99 0110 0011 63 2055 0000 1000 0000 0111 0807

109 0110 1101 6D 63 0000 0000 0011 1111 003F

Exercise 3 (2.5 marks): Compute (b: binary, q: octal, h: hexadecimal)

3245q + 247q = 3674q = 0111 1011 1100b


1A7Bh + 26FE7h = 28A62h = 0010 1000 1010 0110 0010b
1101101101b - 10110111b =0010 1011 0110b
3654q – 337q =q = 0110 1100 1101b
3AB7h – 1FAh = 38BDh = 0011 1000 1011 1101b
36Ah – 576q = 1ECh = 0001 1110 1100b
64AEh – 1001101b= 62141q

101101111b
+ 100111011b
110110001b
110001101b
10111101000b
1011010b* 1011b=1111011110
1101000b + 2ABh + 345q = 3F8h=1770q
3AFh / 1Ch =0010 0001b=33d
3ACh – 562q = 0010 0011 1010b=570d
3FFAh / 327q = 0100 1100b=76d

Exercise 4 (2.5 marks)

1-Show binary formats of 1-byte unsigned numbers: 251, 163, 117


251 = 1111 1011
163 = 1010 0011
117 = 0111 0101
2-Show binary formats of 2-byte unsigned numbers: 551, 160, 443
551 = 0000 0100 0010 0111
160 = 0000 0000 1010 0000
443 = 0000 0001 1011 1011
3-Show binary formats of 1-byte signed numbers: -51, -163, -117, 320
-51 = 1100 1011
-163 = 1010 0001
-117 = 1000 1011
320 không hợp lệ ở 1 byte vì phạm vi của 1 byte là từ -128 đến 127

4-Show the decimal values of 1-byte unsigned representations: :


01100011b, 10001111b, 11001010b, 01001100b

01100011b = 02^7 + 12^6 + 12^5 + 02^4 + 02^3 + 02^2 + 12^1 + 12^0 = 99


10001111b = 12^7 + 02^6 + 02^5 + 02^4 + 12^3 + 12^2 + 12^1 + 12^0 = 143
11001010b = 12^7 + 12^6 + 02^5 + 02^4 + 12^3 + 02^2 + 12^1 + 02^0 = 202
01001100b = 02^7 + 12^6 + 02^5 + 02^4 + 12^3 + 12^2 + 02^1 + 02^0 = 76

You might also like