Unit 2: Number System and Boolean Logic
Complete NEB Class 11 Computer Science Unit 2 notes covering number systems, conversions, binary calculations, complements, Boolean algebra, logic gates and De Morgan’s theorems.
Welcome to Nepal eNotes. In Unit 2, you will learn how computers represent numbers using binary, octal, decimal and hexadecimal number systems.
You will also learn binary addition and subtraction, one’s and two’s complement, Boolean algebra, logic gates, Boolean laws and De Morgan’s theorems.
- 2.1 Number System and Conversion
- 2.1.1 Decimal, Binary, Octal & Hexadecimal
- 2.1.2 Binary Addition and Subtraction
- 2.1.3 One’s and Two’s Complement
- 2.2 Logic Function and Boolean Algebra
- 2.2.2 Boolean Values and Truth Table
- 2.2.3 Logic Gates
- 2.2.4 Laws of Boolean Algebra
- 2.2.5 Verification Using Truth Table
- Quick Revision
A number system is a method of representing numbers using a fixed set of symbols and a specific base or radix.
| Number System | Base | Digits Used | Example |
|---|---|---|---|
| Decimal | 10 | 0–9 | 245 |
| Binary | 2 | 0, 1 | 1101 |
| Octal | 8 | 0–7 | 372 |
| Hexadecimal | 16 | 0–9 and A–F | 1F3 |
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Decimal to Binary
To convert decimal to binary, repeatedly divide the decimal number by 2 and write the remainders. Read the remainders from bottom to top.
Binary to Decimal
Multiply each binary digit by 2 raised to the power of its position, starting with power 0 from the right.
Decimal to Octal
Repeatedly divide the decimal number by 8 and read the remainders from bottom to top.
Decimal to Hexadecimal
Repeatedly divide the decimal number by 16. Remainders from 10 to 15 are represented by A to F.
Binary to Octal Shortcut
Since 8 = 2³, divide binary digits into groups of 3 bits starting from the right.
Binary to Hexadecimal Shortcut
Since 16 = 2⁴, divide binary digits into groups of 4 bits starting from the right.
Binary → Octal = Group in 3 bits
Binary → Hexadecimal = Group in 4 bits
Binary Addition Rules
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Binary Subtraction Rules
| A | B | Difference | Borrow |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
One’s Complement
The one’s complement of a binary number is obtained by changing every 0 into 1 and every 1 into 0.
Subtraction Using One’s Complement
To subtract using one’s complement:
- Find the one’s complement of the subtrahend.
- Add it to the minuend.
- If a carry is generated, add it back to the result.
Two’s Complement
The two’s complement is obtained by finding the one’s complement and then adding 1.
Subtraction Using Two’s Complement
- Find the two’s complement of the subtrahend.
- Add it to the minuend.
- Discard the final carry if one is generated.
One’s complement → Flip all bits.
Two’s complement → Flip all bits + 1.
Introduction to Boolean Algebra
Boolean algebra is a branch of algebra in which variables can have only two possible values: True (1) or False (0).
Boolean algebra is used to analyze and simplify logical statements and digital circuits.
Boolean Values
A Boolean value can have only two states:
- True = 1
- False = 0
These can represent conditions such as ON/OFF, YES/NO or HIGH/LOW.
Truth Table
A truth table shows all possible input combinations of a Boolean expression together with the corresponding output.
Boolean Expression
A Boolean expression combines Boolean variables using operators such as AND, OR and NOT.
Y = A.B + C
Y becomes true when A AND B are true, or when C is true.
Boolean Function
A Boolean function accepts one or more Boolean inputs and produces one Boolean output.
A logic gate is a basic building block of digital circuits that accepts binary input and produces binary output.
AND Gate
Output is 1 only when all inputs are 1.
Y = A.B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR Gate
Output is 1 when at least one input is 1.
Y = A + B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT Gate
The NOT gate reverses the input.
Y = A’
| A | Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
NAND Gate
NAND produces the opposite result of an AND gate.
Y = (A.B)’
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR Gate
NOR produces the opposite result of an OR gate.
Y = (A+B)’
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XOR Gate
XOR gives output 1 when the inputs are different.
Y = A ⊕ B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
XNOR Gate
XNOR gives output 1 when both inputs are the same.
Y = (A ⊕ B)’
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
XOR = 1 when inputs are different.
XNOR = 1 when inputs are same.
Complement Laws
A + A’ = 1
A.A’ = 0
Identity Laws
A + 0 = A
A.1 = A
A + 1 = 1
A.0 = 0
Commutative Laws
A + B = B + A
A.B = B.A
Associative Laws
(A + B) + C = A + (B + C)
(A.B).C = A.(B.C)
Distributive Laws
A.(B + C) = (A.B) + (A.C)
A + (B.C) = (A+B).(A+C)
De Morgan’s First Theorem
(A + B)’ = A’.B’
The complement of an OR expression equals the AND of the individual complements.
De Morgan’s Second Theorem
(A.B)’ = A’ + B’
The complement of an AND expression equals the OR of the individual complements.
Boolean laws can be verified by calculating both sides of an equation for every possible input combination.
Commutative Law
A + B = B + A
| A | B | A+B | B+A |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 |
Distributive Law
A.(B+C) = (A.B)+(A.C)
| A | B | C | B+C | A.(B+C) | A.B | A.C | (A.B)+(A.C) |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
De Morgan’s First Theorem
(A+B)’ = A’.B’
| A | B | A+B | (A+B)’ | A’ | B’ | A’.B’ |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
De Morgan’s Second Theorem
(A.B)’ = A’ + B’
| A | B | A.B | (A.B)’ | A’ | B’ | A’+B’ |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
A Boolean law is verified when the output columns on both sides of the equation are exactly the same for every possible input.
⚡ Quick Revision – Unit 2
- Binary base = 2.
- Octal base = 8.
- Decimal base = 10.
- Hexadecimal base = 16.
- Decimal to another system: repeatedly divide by its base.
- Binary to octal: group binary digits in 3s.
- Binary to hexadecimal: group binary digits in 4s.
- One’s complement: change 0 to 1 and 1 to 0.
- Two’s complement: one’s complement + 1.
- Seven logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR.
- XOR = 1 when inputs are different.
- XNOR = 1 when inputs are same.
- Boolean values are 0 and 1.
- De Morgan’s First Theorem: (A+B)’ = A’.B’.
- De Morgan’s Second Theorem: (A.B)’ = A’+B’.
Frequently Asked Questions
A number system is a method of representing numbers using a fixed set of digits and a particular base or radix.
The four main number systems are Binary, Octal, Decimal and Hexadecimal.
One’s complement is obtained by changing every binary 0 into 1 and every binary 1 into 0.
Two’s complement is obtained by taking the one’s complement of a binary number and adding 1.
Boolean algebra is a system of algebra that works with two values, 0 and 1, and is used in digital circuits and computer logic.
The seven logic gates are AND, OR, NOT, NAND, NOR, XOR and XNOR.
De Morgan’s first theorem is (A+B)’ = A’.B’ and the second theorem is (A.B)’ = A’+B’.
Conclusion
Unit 2 introduces important concepts used by computers to represent numbers and perform digital logical operations.
Students should especially practice number conversions, binary addition and subtraction, complements, logic-gate truth tables, Boolean laws and De Morgan’s theorems for examination preparation.
Continue learning with Nepal eNotes for more NEB Class 11 Computer Science notes and study materials.
Discussion
Share a helpful question, idea, or explanation with other students.