Data Representation Using Binary Digits


Binary Hexadecimal



Download 220,83 Kb.
bet6/6
Sana07.10.2022
Hajmi220,83 Kb.
#851653
1   2   3   4   5   6
Bog'liq
Лаб2 Аружан

Binary

Hexadecimal

0

0000

0x0

1

0001

0x1

2

0010

0x2

3

0011

0x3

4

0100

0x4

5

0101

0x5

6

0110

0x6

7

0111

0x7

8

1000

0x8

9

1001

0x9

10

1010

0xA

11

1011

0xB

12

1100

0xC

13

1101

0xD

14

1110

0xE

15

1111

0xF

Table 5 Decimal, binary, and hexadecimal conversions
Let us convert 0x3B to decimal via binary. The first step is to find out what the individual hexadecimal number represents in binary. Replace the hexadecimal number with the binary number. Therefore, 0x3B becomes 001110112. As you may recall from the previous section on binary, converting numbers from binary to decimal is much easier than with other systems, since multiplying by binary digits of 0 and 1 are trivial.
0x3B=
001110112=
32 + 16 + 8 + 2 + 1 =
59
A byte of data (eight bits) can be written as just two hex digits. For example, the character "N" in extended ASCII code has the binary representation 01001110. If we write this as two groups of four bits each, we get 0100.1110. Using table 5 above, we find that 0100 is 0x4 and 1110 is 0xE. Therefore, the corresponding hexadecimal code for 0100.1110 is 0x4E.
When setting up or maintaining a computer system, you will sometimes encounter hexadecimal numbers as representations of memory addresses, network addresses, or other hardware-related qualities. You may encounter them in operating system-related contexts as well, such as when a machine "crashes" and displays a failure report.
Question 1. Decimal, binary, and hexadecimal conversions
a. Complete the following chart by converting the numbers given in one of the notations to the other two. Show calculations.

Binary

Decimal

Hexadecimal

10001101

140

0x8D

1110011

115

0x3E

11111101

253

0x FD

10101011

171

0xAB

000110111101

445

0x1BD

1×2^7+0×2^6+0×2^5+0×2^4+1×2^3+1×2^2+0×2^1+1×2^0=1×128+0+0+0+1×8+1×4+0=128+8+4=140
1×2^7+1×2^6+1×2^5+1×2^4+1×2^3+1×2^2+0×2^1+1×2^0=1×128+1×64+1×32+1×16+1×8+1×4+0+1×1=128+64+32+16+8+4+1=253

b. What is the minimum number of bits that can be used to represent the decimal number 213? (Hint: convert 252 to binary.)
c. What is the minimum number of bytes that can be used to represent the decimal number 213? 2×10^2+1×10^2+3×10^0=2×100+1×10+3×1=200+10+3=213

d. What is a purpose of using hexadecimal notation? Hexadecimal (base16), or «hex,» is most likely the largest numbering system that you will work with. In the modern decimal system, the Arabic number set 0-9 has to be supplemented by additional values to represent the decimal equivalents of 10, 11, 12, 13, 14, and 15. Instead of inventing new symbols to represent these numbers, the letters A-F are used. Hexadecimal is represented by the set of numbers 0-F. While both lower case and upper case letters can be used in hexadecimal for A-F. In this course, we will use upper case A-F. Hexadecimal, however, is not usually represented by appending a 16 as a subscript to the number. There are two differing formats for representing hexadecimal numbers: prepending 0x or appending h. We will use 0x to denote hexadecimal numbers.
e. What is ASCII code? All data, including audio, visual, and program instruction data can be represented and stored using a sequence of binary digits, or a sequence of bytes. Recall that a file is a collection of data. In some files, the bits of data directly encode individual letters, numbers, and punctuation symbols that make up words and sentences. In other files such as an image file, the bits of data need to be computed in order for them to transform to images that we can interpret.

Question 2. Data Representations in a Computer System
Computer systems are made up of electrical components that are either on, or off, representing 1’s and 0’s, also called binary numbers. All data, such as numbers, are converted into binary representations in the computer system. The Extended ASCII chart below shows characters and their binary representations. Use the chart below and a calculator to answer the following questions:

Figure 1 ASCII code
You can obtain the binary representation of a word by concatenating the ASCII values of each letter. For example, “SSD2” in binary representation is 01010011 01010011 01000100 00110010.
a. “Hex” in binary representation is 01001000 01100101 01111000
b. “Read” in binary representation is _01010010 01100101 01100001 01100100, which is equivalent to in decimal representation.
c. 01010011 01110100 01110101 01000100 01100101 01101110 01110100 is the binary representation of the ASCII string StuDent.
d. 0x47524F5550 is a hexadecimal representation of the ASCII string 00110000 01111000 00110100 00110111 00110101 00110010 00110100 01000110 _00110101 00110101 00110101 00110000
e. 1229542485 is the decimal representation of the ASCII string _00110001 00110010 00110010 00111001 00110101 00110100 00110010 00110100 00111000 00110101_.
Download 220,83 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish