Hello, my dear students! Welcome to Chapter Two of Computer Organization and Architecture (COA). In this lesson, we will study Number Systems and Codes. This chapter is very important because everything inside a computer — numbers, letters, images, sounds — is represented using only 0s and 1s. So understanding how numbers work in different systems is the key to understanding how computers process data. Are you ready? Let’s go step by step!
1. Data Types in Digital Computers
Before we jump into number systems, let me ask you a simple question: What kind of data does a computer store? Think about it for a moment. You type numbers, letters, and symbols on your keyboard. But the computer does not understand any of these directly. It only understands 0 and 1 — which we call the binary form.
So, all data in any form is represented using 0 and 1. This binary information is stored in memory or processor registers. Now, the registers can contain two types of information:
- Data — numbers and other binary-coded information that the computer processes
- Control information — a bit or a group of bits used to specify the sequence of command signals
The data types found in the registers of digital computers include:
- Numbers — used in arithmetic computations (addition, subtraction, etc.)
- Letters of the alphabet — used in data processing (text, names, etc.)
- Other discrete symbols — used for specific purposes (like $, %, @, etc.)
Let me give you a simple example. When you type the letter “A” on your keyboard, the computer stores it as 01000001 in binary. When you type the number 5, the computer stores it as 00000101. Everything — every number, every letter, every symbol — gets converted to binary. That is why we need to study number systems carefully!
• Computer only understands binary (0 and 1)
• Binary information is stored in memory or processor registers
• Registers contain either data or control information
• Data types: Numbers, Letters, and Other discrete symbols
📝 Practice Questions — Data Types
Q1 (MCQ): The binary information stored in processor registers can be classified as:
A) Only data B) Only control information C) Data or control information D) Neither data nor control information
Explanation: According to the PDF, registers contain either data (numbers and other binary-coded information) or control information (a bit or group of bits used to specify the sequence of command signals). Both types coexist in a computer’s registers.
Q2 (MCQ): Control information in a digital computer is:
A) Numbers used in arithmetic computation B) Letters of the alphabet used in data processing C) A bit or group of bits specifying the sequence of command signals D) Binary representation of decimal numbers only
Explanation: Control information is specifically defined as bits that control the sequence of command signals — it tells the computer WHAT to do and WHEN. Options A and B describe data, not control information.
Q3 (List and Explain): List the three data types found in the registers of digital computers and briefly explain each.
1. Numbers: Used in arithmetic computations such as addition, subtraction, multiplication, and division. Examples: 15, 3.14, -7.
2. Letters of the alphabet: Used in data processing tasks like text editing, name storage, and document creation. Examples: A, B, C, z.
3. Other discrete symbols: Used for specific purposes depending on the application. Examples: $, %, @, #, &.
2. Number Systems
Now let me ask you: What is a number system? A number system is simply the way of representing numbers. Different number systems use different bases (also called radices). The most common number systems are four: Decimal, Binary, Octal, and Hexadecimal.
Let me explain each one in detail with examples. Pay close attention because conversion questions come in almost every exam!
2.1 Decimal Number System (Base 10)
The decimal number system is important because it is universally used to represent quantities outside a digital system — meaning this is the number system you and I use every day! It uses digits from 0 to 9 and has a base of 10.
Each position in a decimal number has a place value based on powers of 10. Let me show you with an example from your PDF:
Example: Break down the number 10264
This expansion shows how each digit is multiplied by its place value. The rightmost digit has the lowest power (100 = 1) and the leftmost digit has the highest power. This same concept applies to ALL number systems — we just change the base!
2.2 Binary Number System (Base 2)
The binary number system is the most important number system for computers. It is based on the concept of ON or OFF. Its two digits are denoted by 0 and 1, and each digit is called a bit. The binary number system has a base of 2.
Let me show you how decimal numbers 0 through 9 are represented in binary:
| Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|
| Binary | 0 | 1 | 10 | 11 | 100 | 101 | 110 | 111 | 1000 | 1001 |
Now, let me ask you: can you see the pattern here? Each time we reach the maximum digit (1 in binary), we carry over to the next position. Just like in decimal, when we reach 9 we go to 10.
Examples from the PDF:
- Decimal 14 = (1110)2
- Decimal 19 = (10011)2
- Decimal 50 = (110010)2
2.3 Octal Number System (Base 8)
The octal number system uses exactly eight symbols: 0, 1, 2, 3, 4, 5, 6, and 7. It has a base of 8. One very important fact about octal numbers is that each octal digit has a unique 3-bit binary representation. This makes conversion between octal and binary very easy — we will see that later.
Octal numbers can be converted to decimal values by multiplying each digit with its place value (powers of 8) and then adding the results.
Examples from the PDF:
- Decimal 135 = (207)8
- Decimal 215 = (327)8
Let me verify the first one for you:
2.4 Hexadecimal Number System (Base 16)
The hexadecimal number system spans from 0 to 9 and then continues with A to F. The letters A, B, C, D, E, and F represent the decimal values 10, 11, 12, 13, 14, and 15 respectively. It has a base of 16.
Hexadecimal numbers are more convenient for people to recognize and interpret than the long strings of binary numbers. For example, instead of writing 11111111 in binary, we can simply write FF in hexadecimal — much shorter and easier to read!
Examples from the PDF:
- Decimal 255 = (FF)16
- Decimal 1096 = (448)16
- Decimal 4090 = (FFA)16
Let me verify the first example:
| Number System | Base | Digits Used | Example |
|---|---|---|---|
| Binary | 2 | 0, 1 | (1101)2 |
| Octal | 8 | 0, 1, 2, 3, 4, 5, 6, 7 | (207)8 |
| Decimal | 10 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 | (135)10 |
| Hexadecimal | 16 | 0-9, A, B, C, D, E, F | (FF)16 |
📝 Practice Questions — Number Systems
Q1 (MCQ): The number system with base 8 that uses digits 0 through 7 is called:
A) Binary B) Decimal C) Octal D) Hexadecimal
Explanation: The octal number system has a base of 8 and uses exactly eight symbols: 0, 1, 2, 3, 4, 5, 6, and 7. Binary has base 2, decimal has base 10, and hexadecimal has base 16.
Q2 (MCQ): In the hexadecimal system, what decimal value does the digit ‘D’ represent?
A) 12 B) 13 C) 14 D) 15
Explanation: In hexadecimal: A=10, B=11, C=12, D=13, E=14, F=15. So D represents 13. Don’t confuse D with 12 (that’s C) or 14 (that’s E)!
Q3 (MCQ): Each octal digit corresponds to how many binary digits?
A) 2 bits B) 3 bits C) 4 bits D) 8 bits
Explanation: According to the PDF, “Each octal digit has a unique 3-bit binary representation.” This is because 23 = 8, which matches the base of the octal system. Similarly, each hexadecimal digit corresponds to 4 binary digits (since 24 = 16).
Q4 (Fill in the Blank): The rightmost bit of a binary number is called the _______ and the leftmost bit is called the _______.
Explanation: The rightmost bit has the lowest place value (20) and is called the Least Significant Bit (LSB). The leftmost bit has the highest place value and is called the Most Significant Bit (MSB).
3. Conversion of Number Systems
This is the most exam-tested section of this chapter! You must be able to convert between any two number systems. Let me teach you each conversion method with detailed examples. I will go slow so you understand every step.
3.1 Conversion from Binary to Decimal
The binary number system has a base 2, so the position weights are based on the power of 2. To convert a binary number to decimal, multiply each bit by its place value (2 raised to the position number) and add all the results.
Example 1: Convert (100111)2 to decimal
Example 2: Convert (0.1010)2 to decimal
For fractional binary numbers, the powers of 2 become negative after the decimal point:
Example 3: Convert (1101.1010)2 to decimal
3.2 Hexadecimal to Binary Conversion
This conversion is very easy! Each hexadecimal digit converts to exactly 4 binary digits. Just replace each hex digit with its 4-bit binary equivalent. Let me show you the reference table first:
| Hex Digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| Binary (4-bit) | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |
| Hex Digit | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|
| Binary (4-bit) | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Example: Convert (FF)16 to binary
Example: Convert (448)16 to binary
3.3 Octal to Binary Conversion
Similarly, each octal digit converts to exactly 3 binary digits. Replace each octal digit with its 3-bit binary equivalent.
| Octal Digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| Binary (3-bit) | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |
Example: Convert (207)8 to binary
3.4 Octal → Binary → Hexadecimal Conversion
Sometimes you need to convert from octal to hexadecimal. The easiest way is to go through binary as a middle step: Octal → Binary → Hexadecimal. Here is the procedure:
- Convert octal to binary (replace each octal digit with 3 bits)
- Group the binary bits in groups of 4 (starting from the right)
- Convert each 4-bit group to its hexadecimal equivalent
Example: Convert (327)8 to hexadecimal
3.5 Hexadecimal to Octal Conversion
This is the reverse process: Hexadecimal → Binary → Octal.
- Convert hexadecimal to binary (replace each hex digit with 4 bits)
- Group the binary bits in groups of 3 (starting from the right)
- Convert each 3-bit group to its octal equivalent
Example: Convert (FFA)16 to octal
• Hex ↔ Binary: Each hex digit = 4 binary bits
• Octal ↔ Binary: Each octal digit = 3 binary bits
• Hex ↔ Octal: Go through binary as a bridge (Hex → Binary → Octal or Octal → Binary → Hex)
• Any base → Decimal: Multiply each digit by (base)position and add
• Decimal → Binary: Repeatedly divide by 2, collect remainders bottom-up
📝 Practice Questions — Number Conversions
Q1 (MCQ): Convert (1101.101)2 to decimal:
A) 13.5 B) 13.625 C) 11.625 D) 14.5
Explanation:
Integer part: 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13
Fractional part: 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 0.5 + 0 + 0.125 = 0.625
Total = 13 + 0.625 = 13.625
Q2 (MCQ): The hexadecimal number (A3)16 is equal to which binary number?
A) 10100011 B) 10100001 C) 10100010 D) 11100011
Explanation: A = 1010 in binary, 3 = 0011 in binary. So (A3)₁₆ = 1010 0011 = 10100011. Remember, each hex digit converts to exactly 4 binary bits!
Q3 (MCQ): To convert octal (563)8 to hexadecimal, the correct intermediate binary form is:
A) 101 110 011 B) 0101 0110 0011 C) 101 011 001 D) 0101 1100 11
Explanation: The FIRST step in octal → hex conversion is octal → binary (each octal digit becomes 3 bits): 5=101, 6=110, 3=011. So the intermediate binary is 101 110 011. Then we regroup into 4-bit groups for hex: 0101 1100 11 → pad → 0101 1100 1100 → (16C)₁₆. Option B is the 4-bit grouped version (not the direct intermediate), option C has wrong bits, option D is incorrect padding.
Q4 (Workout): Convert (0.1101)2 to decimal.
Q5 (Workout): Convert (B2F)16 to octal.
Step 1: Hex to Binary
B = 1011, 2 = 0010, F = 1111
(B2F)₁₆ = 1011 0010 1111
Step 2: Group into 3 bits from right
101 100 101 111
Step 3: Convert each group to octal
101 = 5, 100 = 4, 101 = 5, 111 = 7
Answer: (5457)8
4. Binary Arithmetic
Now, let me ask you something: Since computers only understand binary, how do they perform calculations? The answer is — they use binary arithmetic. The machine performs all computations using binary numbers. Let me explain the three basic operations: addition, subtraction, and multiplication.
4.1 Binary Addition
Binary addition operates by the same rules as decimal addition. The only difference is that we only have two digits (0 and 1). A carry to the next higher order position occurs when the sum is decimal 2 (which is binary 10). You must memorize these four rules:
• 0 + 0 = 0
• 0 + 1 = 1
• 1 + 0 = 1
• 1 + 1 = 0 with a carry of 1 into the next position
• 1 + 1 + 1 = 1 with a carry of 1 into the next position (when there is a carry from the previous position)
That last rule is very important! It occurs when both binary digits are 1 AND there is a carry from the previous lower position. So we are adding three 1s. Let me show you the examples from the PDF:
Example 1: 6 + 7 = 13
Let me walk you through column by column from right to left:
- Column 0 (rightmost): 0 + 1 = 1 (no carry)
- Column 1: 1 + 1 = 0 with carry 1
- Column 2: 1 + 1 + 1 (carry) = 1 with carry 1 ← this uses the fifth rule!
- Column 3: 0 + 0 + 1 (carry) = 1
Example 2: 6 + 5 = 11
4.2 Binary Subtraction
Binary subtraction uses “borrowing” — just like decimal subtraction. If you try to subtract 1 from 0, you must borrow from the next higher column. In binary, a borrow from the next column is worth 2 (which is 10 in binary).
• 0 – 0 = 0
• 1 – 0 = 1
• 1 – 1 = 0
• 0 – 1 = 1 with a borrow of 1 from the next position
Example 1: 28 – 26 = 2
Let me walk through this column by column from right to left:
- Column 0: 0 – 0 = 0
- Column 1: 0 – 1 → borrow needed! Borrow from column 2 (which becomes 0). Now 10 – 1 = 1
- Column 2: Was 1, now 0 (after borrow). 0 – 0 = 0
- Column 3: 1 – 1 = 0
- Column 4: 1 – 1 = 0
Example 2: 45 – 7 = 38
4.3 Binary Multiplication
Binary multiplication is actually quite simple because you are only ever multiplying by 0 or 1. It involves a series of “shift and add” steps, identical to long multiplication in decimal. The rules are very straightforward:
• 0 × 0 = 0
• 0 × 1 = 0
• 1 × 0 = 0
• 1 × 1 = 1
Notice that multiplying by 0 always gives 0, and multiplying by 1 gives the original number. Let me show you how the “shift and add” method works:
Example: Multiply 110 × 101
📝 Practice Questions — Binary Arithmetic
Q1 (MCQ): Perform binary addition: 1011 + 1101 = ?
A) 10100 B) 11000 C) 11100 D) 10110
Explanation:
Q2 (MCQ): In binary subtraction, when we compute 0 – 1, the result is:
A) 0 with no borrow B) 1 with borrow 1 C) 1 with no borrow D) 0 with borrow 1
Explanation: According to the binary subtraction rules, 0 – 1 = 1 with a borrow of 1 from the next position. This is because we borrow 2 (which is 10 in binary), and 10 – 1 = 1. The borrow of 1 is passed to the next higher column.
Q3 (MCQ): The binary addition rule for 1 + 1 + 1 (with carry from previous position) gives:
A) 1 with carry 0 B) 0 with carry 1 C) 1 with carry 1 D) 0 with carry 0
Explanation: When adding three 1s (two digits plus a carry), the sum is 3 in decimal, which is 11 in binary. So we write 1 and carry 1 to the next position. This is the fifth rule of binary addition that students often forget!
Q4 (Workout): Perform binary subtraction: 11010 – 01101
Q5 (Workout): Perform binary multiplication: 111 × 110
5. Complements
Now we come to a very important topic. Let me ask you: How does a computer perform subtraction if it only knows how to add? The answer is — by using complements! Complements are used in digital systems to perform logical manipulation, and most importantly, to simplify subtraction by converting it into addition.
The binary number system contains two types of complements:
- 1’s complement
- 2’s complement
Let me explain each one carefully.
5.1 1’s Complement
The 1’s complement of a binary number is very easy to find. You simply invert all the bits — change every 0 to 1, and every 1 to 0. That’s it! There is no complex calculation involved.
To find the 1’s complement of a binary number, invert all bits:
• Change every 0 → 1
• Change every 1 → 0
Example 1: Find the 1’s complement of (0101)
Example 2: Find the 1’s complement of (1101)
5.1.1 Signed Binary Representation
Now, this is a very important concept. In signed binary representation, the leftmost bit is used to indicate the sign of the number:
- 0 = positive number
- 1 = negative number
For example, using a 5-bit representation:
5.2 2’s Complement
The 2’s complement is the most widely used complement in digital systems. It is used for representing negative numbers and for performing subtraction through addition. Here is how to find it:
Step 1: Find the 1’s complement (invert all bits)
Step 2: Add 1 to the 1’s complement result
In short: 2’s complement = 1’s complement + 1
Example 1: Find the 2’s complement of (11010)
Example 2: Find the 2’s complement of (0101)
• It is used to represent negative numbers in computers
• It allows subtraction to be performed as addition (A – B = A + 2’s complement of B)
• It has no ambiguous representation of zero (unlike 1’s complement which has +0 and -0)
• Exam questions frequently ask: “Find the 2’s complement” or “Use 2’s complement to subtract”
📝 Practice Questions — Complements
Q1 (MCQ): The 1’s complement of the binary number (10110) is:
A) 01001 B) 01010 C) 10101 D) 11001
Explanation: 1’s complement = invert all bits.
Original: 1 0 1 1 0
1’s Comp: 0 1 0 0 1
Simply flip every bit: 1→0, 0→1, 1→0, 1→0, 0→1 = 01001
Q2 (MCQ): The 2’s complement of (0110) is:
A) 1001 B) 1010 C) 1000 D) 1101
Explanation:
Step 1: 1’s complement of 0110 = 1001
Step 2: Add 1: 1001 + 1 = 1010
Option A is only the 1’s complement (missing the +1 step). This is the most common wrong answer!
Q3 (MCQ): In signed binary representation, a 5-bit number (10110) represents:
A) +22 B) -6 C) -22 D) +6
Explanation: The leftmost bit is 1, which means the number is negative. The remaining 4 bits (0110) represent the magnitude in 2’s complement form. To find the actual value: find the 2’s complement of 0110 = 1001 + 1 = 1010 = 6. So the number is -6.
Note: If interpreted as unsigned, 10110 = 22. But in signed representation with the leftmost bit as sign, it is -6.
Q4 (MCQ): To obtain the 2’s complement of a binary number, we:
A) Invert all bits only B) Add 1 to the original number C) Invert all bits and then add 1 D) Subtract 1 from the original number
Explanation: The standard procedure for 2’s complement is: Step 1 — Find the 1’s complement (invert all bits), Step 2 — Add 1 to the result. Option A gives only 1’s complement. Option B is incorrect. Option D has no relationship to 2’s complement.
Q5 (Workout): Find the 1’s complement and 2’s complement of (101101).
1’s Complement: Invert all bits
2’s Complement: Add 1 to 1’s complement
Q6 (Workout): Find the 2’s complement of (10000) and verify your answer.
Step 1: 1’s complement of 10000 = 01111
Step 2: Add 1:
Interesting fact: The 2’s complement of a number that is a pure power of 2 (like 10000 = 16) gives back the same number! This is a special case. In signed representation, 10000 in a 5-bit system represents -16 (the most negative number possible with 5 bits).
Q7 (List and Explain): List the two types of complements in the binary number system and explain how each is obtained.
1. 1’s Complement:
• Method: Invert all bits of the binary number (change 0 to 1 and 1 to 0)
• Example: 1’s complement of (0101) = (1010)
• Use: Used as an intermediate step to find 2’s complement; also used in some subtraction algorithms
2. 2’s Complement:
• Method: First find the 1’s complement, then add 1 to the result
• Example: 2’s complement of (0101) = 1010 + 1 = (1011)
• Use: Most widely used complement in digital systems; used to represent negative numbers and to perform subtraction through addition
6. Comprehensive Exam Review Questions
Excellent work, my dear students! You have completed the entire chapter on Number Systems and Codes. Now let me test your understanding with some harder mixed questions. These are the type of questions that appear in actual Ethiopian university exams. Try to answer before clicking “Show Answer”!
🔴 Hard Exam Questions — Mixed Topics
Q1 (MCQ): A binary number has 6 bits. What is the maximum decimal number it can represent?
A) 32 B) 63 C) 64 D) 31
Explanation: With n bits, the maximum unsigned number is 2n – 1. For 6 bits: 26 – 1 = 64 – 1 = 63. The largest 6-bit binary number is (111111)2 = 63. Option C (64) would require 7 bits (1000000).
Q2 (MCQ): The binary subtraction 10100 – 01111 is equal to:
A) 00101 B) 01001 C) 00111 D) 00011
Explanation:
Q3 (MCQ): If the 2’s complement of a number is (1101), then the original number (before complement) is:
A) 0010 B) 0011 C) 1101 D) 1011
Explanation: To find the original number from its 2’s complement, we take the 2’s complement again!
2’s complement of (1101):
Step 1: 1’s complement = 0010
Step 2: 0010 + 1 = 0011
So the original number is (0011). This is a useful property: the 2’s complement of the 2’s complement gives back the original number.
Q4 (MCQ): Which of the following hexadecimal numbers is equal to the octal number (345)8?
A) E3 B) D4 C) E5 D) C5
Explanation:
Step 1: Octal to Binary: 3=011, 4=100, 5=101
(345)8 = 011 100 101
Step 2: Group into 4 bits from right: 1110 0101
Step 3: Convert to hex: 1110 = E, 0101 = 5
Answer: (E5)16
Q5 (Fill in the Blank): In signed binary representation, the leftmost bit is 0 for a _______ number and 1 for a _______ number.
Explanation: In signed binary representation, 0 in the leftmost position denotes a positive number and 1 denotes a negative number. For example, in 5-bit representation: +15 = (01111) and -15 = (11111).
Q6 (Workout): Convert (175)8 to hexadecimal.
Step 1: Octal to Binary
1 = 001, 7 = 111, 5 = 101
(175)8 = 001 111 101
Step 2: Group into 4 bits from right
001 111 101 → 0111 1101
Step 3: Convert to hex
0111 = 7, 1101 = D
Answer: (7D)16
Verification: (175)8 = 1×64 + 7×8 + 5×1 = 64 + 56 + 5 = 125
(7D)16 = 7×16 + 13×1 = 112 + 13 = 125 ✓
Q7 (Workout): Perform binary addition: 11011 + 10111 + 00111
First add 11011 + 10111:
Verification: 27 + 23 + 7 = 57, and 111001 = 32+16+8+0+0+1 = 57 ✓
Q8 (Workout): Find the 2’s complement of (1011001).
Step 1: 1’s complement — invert all bits
Q9 (Write/Explain): Why are complements used in digital systems? Explain with reference to the two types of binary complements.
Complements are used in digital systems to perform logical manipulation. The most important use is to simplify subtraction by converting it into addition. Since computers are designed to efficiently perform addition, using complements allows subtraction (A – B) to be computed as A + (complement of B).
The two types of binary complements are:
1. 1’s Complement: Obtained by inverting all bits of the binary number. It can be used for subtraction but has the disadvantage of having two representations of zero (+0 and -0).
2. 2’s Complement: Obtained by finding the 1’s complement and then adding 1. It is the most widely used complement because it has only one representation of zero and simplifies hardware design for arithmetic operations.
Q10 (MCQ): The binary equivalent of the hexadecimal number (2B6)16 is:
A) 01010110110 B) 001010110110 C) 0010110110 D) 1010110110
Explanation: Each hex digit converts to 4 binary bits:
2 = 0010, B = 1011, 6 = 0110
(2B6)16 = 0010 1011 0110 = 001010110110
Count the bits: 3 × 4 = 12 bits. Option B has exactly 12 bits and matches. Option A has 11 bits (missing leading 0), option C has 10 bits, option D has 10 bits.
7. Final Summary — What to Remember for Your Exam
Wonderful job, students! You have completed the entire Number Systems and Codes chapter. Here is your quick revision checklist — carry this to the exam hall!
1. Data Types: Numbers, Letters, Other symbols — all stored as binary (0 and 1)
2. Number Systems — Bases and Digits:
• Binary: Base 2, digits {0, 1}
• Octal: Base 8, digits {0,1,2,3,4,5,6,7}
• Decimal: Base 10, digits {0,1,2,3,4,5,6,7,8,9}
• Hexadecimal: Base 16, digits {0-9, A,B,C,D,E,F} where A=10, B=11, …, F=15
3. Key Terms:
• LSB = Least Significant Bit (rightmost)
• MSB = Most Significant Bit (leftmost)
4. Conversion Methods:
• Any base → Decimal: Multiply each digit by baseposition, add results
• Hex ↔ Binary: Each hex digit = 4 bits
• Octal ↔ Binary: Each octal digit = 3 bits
• Hex ↔ Octal: Go through binary as bridge
• Fractional binary: Negative powers after decimal point (-1, -2, -3, …)
5. Binary Arithmetic Rules:
• Addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (0 carry 1), 1+1+1=11 (1 carry 1)
• Subtraction: 0-0=0, 1-0=1, 1-1=0, 0-1=1 (borrow 1)
• Multiplication: 0×anything=0, 1×1=1, use shift and add
6. Complements:
• 1’s complement = Invert all bits
• 2’s complement = 1’s complement + 1
• Signed representation: Leftmost bit 0 = positive, 1 = negative
• 2’s complement of 2’s complement = original number
I hope this detailed lesson helped you understand Number Systems and Codes clearly. Practice all the conversion problems and complement calculations again and again — speed and accuracy come with practice. Good luck in your exam, my dear students! You can do it! 💪