Unit – IV
Numbers Systems and Logic Gate
Q.1) Write about the decimal number system?
A1: The Number System represents the value of a number in relation to its basis. A number has a unique representation based on its Base value, and different number systems have different representations of the same number. In microprocessor programming, for example, binary, octal, decimal, and hexadecimal number systems are utilized.
When a number system’s base value is 10, it’s known as a decimal number system, and it plays a crucial part in the advancement of science and technology. The value of each digit is determined by its position (or weight) in a number in the weighted (or positional) number representation.
This is also known as the base-10 number system, which includes ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and so on. Every digit’s position has a weight that is a power of ten. Each position in the decimal system has ten times the significance of the preceding position, which implies that the numeric value of a decimal number is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the products.
The following are some examples of decimal numbers:
(12)10, (345)10, (119)10, (200)10, (313.9)10
The decimal system is a number representation system that employs digits from 0 to 9 to represent a number with base 10. The number is expressed in base-10, with 0 or the first nine positive integers denoting each value. The place value of power 10 is assigned to each value in this number system. It signifies that the numeral in the tens place is ten times the digit in the unit place.
More example
(92)10 = 9×101+2×100
(200)10 = 2×102+0x101+0x100
The decimal numbers which have digits present on the right side of the decimal (.) denote each digit with decreasing power of 10. Some examples are:
(30.2)10= 30×101+0x102+2×10-1
(212.367)10 = 2×102+1×101+2×100+3×10-1+6×10-2+7×10-3
Q.2) Write the advantages and disadvantages of decimal number system?
A2: Advantages and Disadvantages
The key advantages of the Decimal Number System are that it is simple to read, use, and alter.
However, there are certain drawbacks, such as squandering space and time. Because digital systems (e.g., computers) and hardware are based on the binary system (either 0 or 1), each bit of a decimal number requires 4 bits of space, whereas a hexadecimal number requires only 4 bits and has more digits than a decimal number, which is an advantage of the Hexadecimal Number System.
Q.3) What is a binary Number System?
A3: One type of Number Representation approach is the Binary Number System. It's the most common and widely utilized in digital systems. The binary system is used to describe binary quantities that can be represented by any device with only two possible operating states. A switch, for example, has only two states: open and closed.
One of the four types of number systems is a binary number system. Binary numbers are represented by simply two symbols or digits in computer applications, namely 0 (zero) and 1 (one) (one). The base-2 numeral system is used to express the binary numbers. A binary number, for example, is (101)2. In this approach, each digit is referred to as a bit.
There are just two symbols or possible digit values in the Binary System, namely 0 and 1. Any device with only two functioning states or conceivable circumstances is represented by this term. The addition of a 0b prefix or a 2 suffix to a binary number indicates it is binary.
Every digit's position has a weight that is a power of two. Each place in the Binary system is worth twice as much as the preceding one, hence the numeric value of a Binary number is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the results. As a result, it's also a weighted (or positional) number system.
Binary Number Tables
Number | Binary Number | Number | Binary Number | Number | Binary Number |
1 | 1 | 11 | 1011 | 21 | 10101 |
2 | 10 | 12 | 1100 | 22 | 10110 |
3 | 11 | 13 | 1101 | 23 | 10111 |
4 | 100 | 14 | 1110 | 24 | 11000 |
5 | 101 | 15 | 1111 | 25 | 11001 |
6 | 110 | 16 | 10000 | 26 | 11010 |
7 | 111 | 17 | 10001 | 27 | 11011 |
8 | 1000 | 18 | 10010 | 28 | 11100 |
9 | 1001 | 19 | 10011 | 29 | 11101 |
10 | 1010 | 20 | 10100 | 30 | 11110 |
Q.4) Write some examples of a binary number system?
A4: Example 1:
The number 90.75 is interpreted as
Example 2:
A decimal number 21 to represent in Binary representation
(21)10 =16+0+4+0+1 = 1x24+0x23+1x22+0x21+1x20 = (10101)2
So, the decimal value 21 is equivalent to 10101 in the Binary Number System.
Q.5) Explain octal number system?
A5: One form of Number Representation approach is the Octal Number System, in which the base value is 8. That means there are just eight symbols or digit values available: 0, 1, 2, 3, 4, 5, 6, 7. Any digit's value can be represented using only three bits. The addition of a 0o prefix or an 8 suffix to an octal number indicates it is an octal number.
Every digit's position has a weight that is a power of eight. Each place in the Octal system is 8 times more significant than the preceding position, so that the numeric value of an octal number is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the products. So, it is also a positional (or weighted) number system.
Representation
Each Octal number can be expressed using only three bits, with distich values ranging from 000 (for 0) to 111 (for 7 = 4+2+1). The binary equivalents of Octal numbers are listed below -
Octal Digit Value | Binary Equivalent |
0 | 000 |
1 | 001 |
2 | 010 |
3 | 011 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
Example
The number 65.125 can be translated as
65.125 =1x82+0x81+1x80+1x8-1=101.10
The least significant bit (LSB) is 0 on the right, and the most significant bit is 1 on the left (MSB).
Application
The use of octal numerals isn't as popular as it once was. When the amount of bits in a single word is a multiple of three, however, Octal is employed. It's also a shortcut for representing file permissions on UNIX systems and UTF8 integers, among other things.
Q.6) Write the advantages and disadvantages of octal number system?
A6: Advantages and Disadvantages
The key advantage of adopting Octal numbers over decimal and hexadecimal numbers is that it needs fewer digits. As a result, there are fewer computations and errors. It simply takes three bits to represent any binary digit, and it's simple to convert from octal to binary and vice versa. Input and output are easier to manage with the octal format.
The main problem of the octal number system is that computers cannot understand it directly, necessitating the use of an octal to binary converter.
Q.7) Describe a hexadecimal number system?
A7: The Hexadecimal Number System is a sort of numerical representation in which the base number is 16. This indicates that there are only 16 potential 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 values 10, 11, 12, 13, 14, and 15 in single bits. Any digit's value can be represented using only four bits. The addition of a 0x prefix or a h suffix to a decimal number indicates it is hexadecimal.
Every digit's position has a weight that is a power of 16. The numeric value of a hexadecimal number is found by multiplying each digit by the value of the place in which the digit appears and then adding the products in the Hexadecimal system. As a result, it's also a weighted (or positional) number system.
Hexadecimal number systems can be translated to binary (base-2) and octal (base-8) number systems, as well as decimal number systems (base-10). The notion of the number system is extensively covered in the Class 9 syllabus.
The table below contains a list of 16 hexadecimal digits and their equivalent decimal, octal, and binary representations, which will aid in number system conversion. This list can also be used as a converter or translator.
Representation
The table below shows the comparable values of binary and decimal number systems in hexadecimal number systems.
Decimal Numbers | 4-bit Binary Number | Hexadecimal Number |
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 |
Example
The number 2015.0625 is interpreted as
2015.0625=7x162+13x161+15x160+1x16-1=7DF.10
Here, right most bit 0 is the least significant bit (LSB) and left most bit 7 is the most significant bit (MSB).
Q.8) Write the advantages and disadvantages of hexadecimal number system?
A8: Advantages and Disadvantages
Hexadecimal numbers have the advantage of requiring less memory to hold more numbers; for example, it can store 256 numbers in two digits, but decimal numbers can only store 100 numbers in two digits. Computer memory addresses are also represented using this number system. It is simple to convert from hexadecimal to binary and vice versa since it just takes four bits to represent every digit in binary. Input and output are easier to manage in hexadecimal format. In the fields of data science, artificial intelligence, and machine learning, there are numerous benefits.
The main problem of the Hexadecimal number system is that it is difficult for people to read and write it, and it is also difficult to execute operations such as multiplications and divisions using it. The most complex number system for working with computer data is hexadecimal.
Q.9) Write the application of hexadecimal number system?
A9: Application
In computer programming and microprocessors, the Hexadecimal Number System is widely utilized. Color descriptions on web pages are also useful. Each of the three fundamental colors (red, green, and blue) is represented by two hexadecimal digits, yielding 255 potential values and a total of over 16 million colors. Every byte is described in memory using the hexadecimal number system. For Computer Professionals, hexadecimal numbers are also easier to understand and write than binary or decimal numbers.
Q.10) Convert decimal to other number system?
A10: Decimal to Binary
To convert a decimal number to a binary counterpart, divide the original number system by 2 until the quotient is 0, at which point no more division is feasible. The residue is counted for the needed number in LSB (least significant bit) to MSB (most significant bit) order (most significant bit). Let's have a look at an example.
Example - Convert 2610 into a binary number.
Given 2610 is a decimal number.
Divide 26 by 2
26/2 = 13 Remainder →0 (MSB)
13/2 = 6 Remainder →1
6/2 = 3 Remainder →0
3/2 = 1 Remainder →1
½ = 0 Remainder →1 (LSB)
Hence, the equivalent binary number is (11010)2
● Decimal to Octal
The decimal number must be divided by 8 until the quotient reaches 0 in this case. Then we count the remainder from LSB to MSB in the same way to get the equivalent octal number.
Example: Convert 6510 into an octal number.
Given 6510 is a decimal number.
Divide by 8
65/8 = 8 Remainder →1 (MSB)
8/8 = 1 Remainder →0
⅛ = 0 Remainder →1 (LSB)
Hence, the equivalent octal number is (101)8
● Decimal to Hexadecimal
To get the comparable hex, divide the given decimal number by 16. We keep dividing the number until we achieve the quotient 0.
Example: Convert 12710 to a hexadecimal number.
Given 12710 is a decimal number.
Divide by 16
127/16 = 7 Remainder →15
7/16 = 0 Remainder → 7
In the hexadecimal number system, alphabet F is considered as 15.
Hence, 12710 is equivalent to 7F16
Q.11) Convert binary to other number system?
A11: Binary to octal
With the help of the table below, you may convert a binary number to an octal number.
Octal Number | Equivalent Binary Number |
0 | 0 |
1 | 1 |
2 | 10 |
3 | 11 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
Example - Convert (100010)2 to octal number.
With the help of the table we can write,
100→4
And 010→2
Therefore, (100010)2 = 42
Similarly, we can convert an octal number to a binary number with the help of the table.
● Binary to decimal
Converting from binary to hexadecimal is a simple process. All you have to do now is convert the binary numbers to hexadecimal numbers.
Example: Convert (11011)2 to decimal number.
Given (11011)2 a binary number.
We need to multiply each binary digit with the decreasing power of 2. That is;
1×24+1×23+0x22+1×21+1×20
=16+8+0+2+1
=27
Therefore, (11011)2 = (27)10
● Binary to hexadecimal
Converting from binary to hexadecimal is a simple process. All you have to do now is convert the binary numbers to hexadecimal numbers.
Example: Convert (11100011)2 to hexadecimal.
From the table, we can write, 11100011 as E3.
Therefore, (11100011)2 = (E3)16
Q.12) Convert octal to other number system?
A12: Octal to binary
The octal number table can also be used to convert a number with base 8 to a number with base 2. We can also convert a binary number to an octal number using this table. Let's start with the table.
Octal Number | Equivalent Binary Number |
0 | 000 |
1 | 001 |
2 | 010 |
3 | 011 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
Example: Convert 128 into a binary number.
Given, 128 is the octal number.
Now with the help of the table, we can write;
128 = (001 010)2
Since zeros on the left, most of digit 1 does not have any significance. Thus,
128 = (1010)2
● Octal to decimal
To convert an octal number to a decimal number, multiply each of the octal's digits by the reduction power of eight.
Let's look at how to convert an octal number to a decimal number, or how to go from base 8 to base 10.
Example - Let 125 is an octal number denoted by 1258. Find the decimal number.
1258 = 1× 82 + 2 × 81 + 5 × 80
= 1 × 64 + 2 × 8 + 5 × 1 = 64+16+5
=8510
● Octal to hexadecimal
Numbers and alphabets make up hexadecimal numbers. Base 16 is used to represent it. From 0 to 9, the numbers are written as normal, but from 10 to 15, they are written as A, B, C, D, E, and F. Two steps are required to convert an octal number to hexadecimal.
Convert the octal number to a decimal number first.
After that, transform the decimal number to hexadecimal.
Let's look at an example to help us understand. We'll use the same example of converting an octal number to a decimal number, such as;
(55)8 = (45)10
Divide 45 by 16 until you have a remainder less than 16 then convert (45)10 to a hexadecimal value.
Therefore, we can write, (45)10 = (2D)16
Or (55)8 = (2D)16
Q.13) Convert hexadecimal to other number system?
A13: Hexadecimal to binary
The encoding of a hexadecimal number in binary form is shown here. Each hexadecimal number can be represented with only four digits, with each group having a different value ranging from 0000 (for 0) to 1111 (for F= 15 =8 + 4 + 2 + 1).
Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Binary | 0 | 1 | 10 | 11 | 100 | 101 | 110 | 111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
● Hexadecimal to octal
The representation of a hexadecimal number in octal number form is shown here.
Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17
|
● Hexadecimal to decimal
The representation of a hexadecimal number in decimal form is shown here.
Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
|
Q.14) Explain basic logic gates?
A14: Logic gates are the fundamental components of any digital system. It's an electrical circuit with only one output and one or more inputs. A specific logic governs the relationship between the input and the output. AND gate, OR gate, NOT gate, and so on are examples of logic gates.
AND Gate
The AND gate is an electrical circuit that only outputs a high value (1) if all of its inputs are also high. The AND operation, i.e. A.B., is represented by a dot (.). It's worth noting that this dot is sometimes deleted, as in AB.
Logic diagram
Fig 1: AND gate
Truth table
OR Gate
If one or more of its inputs are high, the OR gate produces a high output (1). The OR operation is represented by a plus (+).
Logic diagram
Fig 2: OR gate
Truth table
Not Gate
The NOT gate is a type of electrical circuit that outputs an inverted version of the input. An inverter is another name for it. The inverted output is known as NOT A if the input variable is A. As shown at the outputs, this is also displayed as A', or A with a bar over the top. The diagrams below demonstrate two different ways to arrange the NAND logic gate to form a NOT gate. In the same way, it may be done with NOR logic gates.
Logic diagram
Fig 3: NOT gate
Truth table
Q.15) Describe universal logic gates?
A15: The NAND and NOR gates are called universal functions since with either one the AND OR functions and NOT can be generated.
NAND Gates
This is a NOT-AND gate, which is a combination of an AND gate and a NOT gate. If any of the inputs is low, the outputs of all NAND gates are high. An AND gate with a little circle on the output is the symbol. Inversion is represented by the little circle.
Logic diagram
Fig 4: NAND gate
Truth table
NOR Gates
This is a NOT-OR gate, which is a combination of an OR gate and a NOT gate. If any of the inputs is high, the outputs of all NOR gates are low.
An OR gate with a little circle on the output is the symbol. Inversion is represented by the little circle.
Logic diagram
Fig 5: NOR gate
Truth table
Q.16) Find the decimal value of the binary number (11001011)2 using the positional notation method of binary to decimal conversion?
A16: By the positional notation of binary to decimal conversion, we multiply every digit in the binary number with its base raised to the power based on its position. This is done by starting from the rightmost digit and moving on to the left and summing up all the values.
In the binary to decimal conversion shown below, we start from the right and move towards the left.
(11001011)2 = (1 × 20) + (1 × 21) + (0 × 22) + (0 × 23) + (1 × 24) + (0 × 25) + (1 × 26) + (1 × 27)
= (1 × 1) + (1 × 2) + (0 × 4) + (1 × 8) + (0 × 16) + (0 × 32) + (1 × 64) + (1 × 128)
= 1 + 2 + 0 + 8 + 0 + 0 + 64 +128
= 203
.
Q.17) Using the doubling method of binary to decimal conversion, find the decimal value of (10101101)2?
A17: For the binary to decimal conversion of a number using the doubling method, we use the following steps:
Step 1: Write the binary number and start from the left-most digit. Take the doubled value of the previous digit and add it with the current digit. Since in the binary number 101011012, '1' is the left-most digit and there is no previous number, the doubled value is 0. Now, adding it with the current value which is 1, we get (0 × 2) + 1, which is 1.
Step 2: Follow the same step as described in step 1 for all the numbers as you move on to the right.
Step 3: Finally, the sum that is achieved in the last step is the decimal equivalent of the binary value.
The steps that were discussed above for the binary to decimal conversion are shown below:
Q.18) Convert binary number 1101010 into hexadecimal number?
A18: First convert this into decimal number:
= (1101010)2
= 1x26+1x25+0x24+1x23+0x22+1x21+0x20
= 64+32+0+8+0+2+0
= (106)10
‘Then, convert it into hexadecimal number
= (106)10
= 6x161+10x160
= (6A)16 which is answer.
Q.19) Convert binary number 001100101.110111 into hexadecimal number?
A19: Binary to hexadecimal is,
= (001100101.110111)2
= (0 0110 0101. 1101 1100)2
= (0110 0101. 1101 1100)22
= (6 5. D C)16
= (65.DC)16
Q.20) Convert binary number 1010101101001 into hexadecimal number?
A20: Binary to hexadecimal is,
= (1010101101001)2
= (1 0101 0110 1001)2
= (0001 0101 0110 1001)2
= (1 5 6 9)16
= (1569)16