NTA UGC NET 2023 » NTA Study Materials » Computer Science » Binary and Hexadecimal Representations

Binary and Hexadecimal Representations

In this article, we have outlined the binary and hexadecimal representation of numbers. Their conversion and decimal representation as well.

Binary Number system:

A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method of mathematical expression which represents numeric values using two unique digits (0 and 1). Most computing devices use binary numbering to represent electronic circuit voltage state, (i.e., on/off switch), which considers 0 voltage input as off and 1 input as on.

The base-2 numeral system is a positional notation with a radix of 2. Each digit is referred to as a bit or binary digit. Because of its straightforward implementation in digital electronic circuits using logic gates, the binary system is used by almost all modern computers and computer-based devices, as a preferred system of use, over various other human techniques of communication, because of the simplicity of the language.

Binary Number Representation:

  1. Sign Magnitude Representation: The most basic and widely used method of denoting positive and negative numbers is sign-magnitude notation. Negative numbers are created by simply altering the sign of the corresponding positive number, such as +9 and -9, +1 and -1, and so on. Similarly, placing a 1 in front of a binary number makes it negative, whereas putting a 0 in front of it makes it positive. Sign is represented by the leftmost digit of a binary number. Ex: 0101111 represents +47 and 1101111 represents -47. 
  2. One’s complement:  In a signed binary number system, One’s Complement is a technique that can be used to denote negative binary numbers. Positive numbers are not altered in one’s complement. One’s Complement of a negative number is calculated by interchanging the digits of the number. It can be also calculated by subtracting equal no. of 1’s and the negative binary number. Thus one’s complement of 1 is 0 and of 0 is 1. Ex: One’s Complement of 10101010 is 01010101.(11111111-10101010=01010101)
  3. Two’s Complement: Two’s Complement is also a technique which is used to denote negative binary numbers like one’s complement form. Positive numbers are not altered in two’s complement. A negative number  is represented by a binary number in such a way that when it is added to its corresponding positive equivalent it results in zero. For calculating the two’s complement of a number we need to find its one’s complement as two’s complement is one’s complement + 1 of a number in binary.
  4. Real number representation: This is used to denote a number with a decimal point in binary. IEEE 754 standard has defined how to represent a real number using 32 bits and 64 bits. It has three components: 
  1. Plus/Minus sign: This is represented by the leftmost bit in the binary number.
  2. Exponent: it is encoded using 8 bits (11 bits in 64-bit representation) immediately after the sign. 
  3. Mantissa:  It is the bits after the decimal point and is denoted with the remaining 23 bits(52 bits in 64-bit representation).

Hexadecimal Number System:

The Hexadecimal Number System is a form of Number Representation system in which the base number is 16. The addition of a 0x prefix or a h suffix to a decimal number indicates it is hexadecimal. Any digit’s value can be represented using only four bits. This defines that there are only 16 digit values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Where A, B, C, D, E, and F represent the decimal numbers 10, 11, 12, 13, 14, and 15 in single bits. 

Numeric value of the hexadecimal system is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the products. Value of digits at each location in the Hexadecimal system has 16 times the significance of the preceding position. Every digit’s position has a weight that is a power of 16.

Ex: 5C4= 5*16^2+C*16^1+4*16^0= 1280+192+4=1476

Hexadecimal Representation:

Each Hexadecimal number can be represented using only 4 bits, with each group of bits having a distinct value between 0000 (for 0) and 1111 (for F = 15 = 8+4+2+1). The equivalent binary number of Hexadecimal numbers is as given below.

Decimal

Binary 

Hexadecimal

0

0000

0

1

0001

1

2

0010

2

3

0011

3

4

0100

4

5

0101

5

6

0110

6

7

0111

7

8

1000

8

9

1001

9

10

1010

A

11

1011

B

12

1100

C

13

1101

D

14

1110

E

15

1111

F

Since the base value of the Hexadecimal number system is 16, there maximum value of a digit is 15 and it can not exceed 15. In this number system, the successive positions to the left of the hexadecimal point starting from the rightmost digit  have weights of 16^0, 16^1, 16^2, 16^3 and so on respectively. Similarly, the successive positions to the right of the hexadecimal point starting from the leftmost digit  have weights of 16^-1, 16^-2, 16^-3 and so on. This is called the base power of 16. The decimal value of any hexadecimal number can be determined using the sum of the product of each digit with its positional value. Ex: 512 is interpreted as 572=2×16^2+7×16^1+0x16^0=624.

Binary Vs Hexadecimal:

Computers can only think in binary. All information is stored and processed in binary. But scientists and hardware designers tend to think in hexadecimal. Hexadecimal maps appropriately to the binary that computers are designed to display binary as hexadecimal on screen. Hexadecimal is human-readable while binary is not. Hence we need to learn about conversions of values from binary to hexadecimal and hexadecimal to binary.

Binary to Decimal:

Decimal number system is the standard form. It has base 10 and numbers are represented as 1,2,3,4,5,6,7,8,9,10. It uses 10 digits from 0 to 9 and all the numbers are represented using these numbers only. All the numbers can be converted to a decimal number system to know the actual numeric value of the number as the decimal number system is the standard form used worldwide.

Numeric value of the binary number system is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the products. Value of digits at each location in the binary system has 2 times the significance of the preceding position. Every digit’s position has a weight that is a power of 2.

Binary numbers are listed in the powers of 2 from right to left as 2^0,2^1,2^2 and so on. This is called the base power of 2. The decimal value of any binary number can be determined using the sum of the product of each digit with its positional value.

Ex: 1001= 1*2^3+0*2^2+0*2^1+1*2^0=8+0+0+1=9

Conversions:

Decimal number representation is the standard form of representation of mathematical numbers. For converting Hexadecimal to Binary or Binary to Hexadecimal we can convert the value first to decimal as it is the standard form or we can do it directly. Consider the following table for the conversions.

Decimal

Binary 

Hexadecimal

0

0000

0

1

0001

1

2

0010

2

3

0011

3

4

0100

4

5

0101

5

6

0110

6

7

0111

7

8

1000

8

9

1001

9

10

1010

A

11

1011

B

12

1100

C

13

1101

D

14

1110

E

15

1111

F

Conclusion:

Binary and hexadecimal representation in computer systems is very important for computing. Values are stored and processed by a computer in binary representation which is a base 2 representation, a decimal representation which is a base 10 representation and hexadecimal representation which is a base 16 representation. Knowing about them, their applications and conversion helps us to understand the processing and working of a computer better.

faq

Frequently asked questions

Get answers to the most common queries related to the NTA Examination Preparation.

What is a bit?

Ans. A bit is a single digit in the binary number. For example, 101 is a three-bit binary number, where 1, 0 and 1 a...Read full

What are decimal numbers?

Ans. Decimal numbers are base 10 representations of numbers. Which is the standard form of representation of mathema...Read full

What are the applications of hexadecimal representation?

Ans. Hexadecimal Number System is commonly used in Computer programming and Microprocessors. It is also helpful to d...Read full

What is the hexadecimal equivalent of 11100011?

Ans. 11100011 is represented as E3.

What is the decimal representation of 5C6?

Ans. The decimal representation of 5C6 is : Step 1:The “5 “ is the ...Read full