Number Systems
Binary, Octal and Hexadecimal Systems
Learning Objectives: Describe positional notation and manually convert numbers between different bases (2, 8, 10, and 16)
Binary number system:
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = 10
1011 = 11
1100 = 12
1101 = 13
1110 = 14
1111 = 15
Octal Number System:
Octal number system has a base of 8 : (0,1,2,3,4,5,6,7)
Hexadecimal number system (16-base)
Hexadecimal numbers are made of 16 digits, it uses the digits 0 through 9 plus the letters A, B, C, D, E, F.
Solved Example: 9922-01
Which among the following are basic numbers that are used in Binary Numerical System? (MP Vyapam Sub Engineer Sep. 2018 shift I Mechanical)
A. 2 and 3
B. 1 and 3
C. 1 and 2
D. 0 and 1
Correct Answer: D
Solved Example: 9922-02
A-F system is used in which of the following number systems? (UGC NET Sep 2020 Shift II)
A. Binary
B. Octal
C. Hexadecimal
D. Decimal
Correct Answer: C
Solved Example: 9922-03
Computer uses which number system to store data and perform calculations? (UGC NET Jun 2019 Shift II
A. Binary
B. Octal
C. Decimal
D. Hexadecimal
Correct Answer: A
Solved Example: 9922-04
Given below are two statements
Statement I: The base of the binary number system is 2.
Statement II: Binary addition is just like decimal addition except that the rules are much simpler.
(UGC NET Paper I: Nov 2021 Shift II)In light of the above statements, choose the correct answer from the options given below
A. Both Statement I and Statement II are true.
B. Both Statement I and Statement II are false.
C. Statement I is true but Statement II is false.
D. Statement I is false but Statement II is true.
Correct Answer: A
Conversion from-to Decimal Number System
Learning Objectives:
- Demonstrate the ability to convert decimal numbers into binary and hexadecimal numbers and vice versa.
Convert the following from decimal to binary.
23
23/2 = 11 remainder = 1
11/2 = 5 remainder = 1
5/2 = 2 remainder = 1
2/2 = 1 remainder = 0
1/2 = 0 remainder = 1
Now take all remainders backwards. (10111)$_2$, that is the answer.
Let's check whether it is correct or not.
Let's convert this from binary to decimal back.
\[(10111)_2 = 1 \times 2^4 + 0 \times 2^3 + 1 \times 2^2 + 1 \times 2^1 + 1 \times 2^0\]
\[(10111)_2 = 16 + 0 +4 + 2 + 1 = 23_{10}\]
Solved Example: 9923-01
Convert 45 into binary number. (DFCCIL Executive Operating 2016)
A. 111001
B. 101101
C. 101010
D. 101111
Rem | ||
---|---|---|
2 | 45 | |
2 | 22 | 1 |
2 | 11 | 0 |
2 | 5 | 1 |
2 | 2 | 1 |
2 | 1 | 0 |
0 | 1 |
Correct Answer: B
Solved Example: 9923-02
Convert 48 decimal to binary. (DSSSB LDC Aug 2019 Shift I)
A. 101110
B. 110000
C. 101000
D. 101100
Rem | ||
---|---|---|
2 | 48 | |
2 | 24 | 0 |
2 | 12 | 0 |
2 | 6 | 0 |
2 | 3 | 0 |
2 | 1 | 1 |
0 | 1 |
Correct Answer: B
Solved Example: 9923-02
Which one of the following is correct? (KSET 2017 Paper I)
A. $(16)_{10} = (18)_{H}$
B. $(10)_{10} = (10)_{8}$
C. $(20)_{10} = (10100)_{2}$
D. $(20)_{10} = (10110)_{2}$
Correct Answer: C
Solved Example: 9923-03
Which of the following is the binary equivalent of the decimal number 35? (UGC NET Nov 2020 Shift II)
A. 100001
B. 100101
C. 100011
D. 101001
Correct Answer: C
Fractions in Number Systems
We can use the same concept for converting a fraction from one number system to another as before.
The positional weightage is now power with a negative index.
Let us see one example.
Convert 0.101 from binary to decimal. \begin{align*} (0.101)_2 &= 1 \times 2^{-1} + 0 \times 2^{-2} + 1 \times 2^{-3} \\ &= 0.5 + 0 + 0.125\\ &= (0.625)_{10} \end{align*}Solved Example: 9921-01
The representation of a floation point binary number +1001.11 in 8 -bit fraction and 6-bit exponent formate is: (NIMCET 2017)
A. Fraction : 01001110 exponent : 000100
B. Fraction : 00001001 exponent : 000011
C. Fraction : 10010000 exponent : 110000
D. Fraction: 00100100 exponent :011000
Correct Answer: A
Solved Example: 9921-02
What is the binary equivalent of the decimal number 67.625? (UGC NET Paper I Nov 2021 Shift II)
A. 1000010.110
B. 1000011.110
C. 1000010.101
D. 1000011.101
Correct Answer: D
Solved Example: 9921-03
What is the binary equivalent of the decimal number 67.625? (UGC NET Paper I: Nov 2021 Shift II)
A. 1000010.110
B. 1000011.110
C. 1000010.101
D. 1000011.101
Correct Answer: D
Solved Example: 9921-04
Convert binary number 1101.1101 into octal number: (DSSSB JE Elec June 2022 Shift I)
A. 15.15
B. 15.64
C. 13.15
D. 13.13
Correct Answer: B
BCD and Grey Code
Learning Objectives:
- Compute gray code and Excess-3 from a given binary code and vice versa.
BCD Code:
BCD code of 62, then we have to get a two-digit binary number of different digits 6 and 2.
6 = 110
2 = 010
Hence BCD of 62 = 110 010
Grey Code: Gray Code is non- weighted code and is a special case of unit-distance code.
In unit-distance code, bit pattern for two consecutive number differ in only one bit position.
These codes are also called as cyclic code for Example:
Gray code for decimal number 5 is 0 1 1 1 and
Gray code for decimal number 6 is 0 1 0 1 .
These two codes only differs by one bit position.
This code is extensively used in shaft encoder because of this property.
Gray Code is reflected code.
Gray code can be constructed using following properties.
- A 1 Bit Gray Code has two code words 0 and 1 representing Decimal No. 0 and 1 respectively.
- An (n-bit) n>2 Gary Code will have first 2n-1 Gray Codes of (n-1) bit written in order write leading 0 appended.
- The last 2n-1 Gray Code will be equal to Gray Code words of an (n-1) bit Gray Code, written in reverse order.
Solved Example: 9957-01
The 4-bit Gray code for decimal number 5 is: (LMRC SCTO Electronics 2018)
A. 0111
B. 1010
C. 1110
D. 1000
Correct Answer: A
Solved Example: 9957-02
The code used to reduce the error due to ambiguity in reading of a binary optical encoder is: (TANGEDCO AE EE 2015)
A. Octal code
B. Excess-3 code
C. Gray code
D. BCD code
Correct Answer: C
Solved Example: 9957-03
The four-bit Gray code corresponding to the binary code 0011 is:
A. 1100
B. 0001
C. 0011
D. 0010
Correct Answer: D
Solved Example: 9957-04
Which of the following is not an invalid BCD Code? (UPPCL JE Nov 2019)
A. 1011
B. 1010
C. 1001
D. 1100
Correct Answer: C
Solved Example: 9957-05
In Binary-coded Decimal (BCD) systems, the decimal number 81 is represented as: (
A. 10000001
B. 10100010
C. 01010001
D. 00011000
Correct Answer: A
Solved Example: 9957-07
Which of the following BCD code, is a sequential code and therefore can be used for arithmetic operations as well as has six invalid states 0000, 0001, 0010, 1101, 1110 and 1111? (DFCCIL Executive S&T Sept 2021)
A. The excess three code
B. Error detecting code
C. The 8421 BCD code
D. The Gray code
Correct Answer: A