Follow Us
Select Medium / माध्यम चुनें:
Eng (English) Hindi (हिन्दी)
JAC • Class 8 • Computer Science • Ch 2
Estimated Time: 45 Mins
Study Progress: In Progress

Number System and Boolean Logic

In Class 8 Computer Science, "Number System and Boolean Logic" represents the mathematical foundation of digital computer architecture and microchip engineering, aligned with the JCERT and NCERT curriculum. Because electronic microprocessors consist of billions of microscopic semiconductor transistors acting as binary switches (voltage ON versus voltage OFF), computers cannot natively comprehend human decimal arithmetic. This authoritative guide introduces students to positional number systems: Decimal (Base 10), Binary (Base 2), Octal (Base 8), and Hexadecimal (Base 16). Students master algorithmic conversion techniques including successive division for integer conversion, positional weight multiplication, and 3-bit/4-bit binary grouping methods for rapid Octal and Hexadecimal translation. The chapter provides rigorous practice in binary arithmetic (binary addition with carry generation, subtraction, 1’s complement, and 2’s complement arithmetic for signed integer representation). Finally, the curriculum examines Boolean Algebra pioneered by George Boole: truth tables, logical propositions, fundamental gates (AND, OR, NOT), universal gates (NAND, NOR), and arithmetic gates (XOR, XNOR), culminating in formal algebraic proofs of De Morgan’s Laws ($\overline{A \cdot B} = \overline{A} + \overline{B}$ and $\overline{A + B} = \overline{A} \cdot \overline{B}$).

🔢 How Can Only Two Numbers—0 and 1—Render 3D Video Games, Artificial Intelligence, and Space Rocket Controls?

Inside your computer processor sits a silicon chip no bigger than your fingernail, packed with over 15 billion microscopic transistors. Each transistor can only do one of two things: let electrical current flow (1) or block it (0). How does this simple binary flicking turn into Beethoven’s symphonies, ultra-high-definition Hollywood movies, and complex space navigation equations? The answer lies in the pure elegance of positional number systems and Boolean logic gates—the mathematical brain of computing!

Why This Chapter Matters

Mastery of number systems and Boolean algebra is crucial for computer science, digital electronics, hardware design, memory addressing, cryptographic hashes, and low-level software optimization.

Before You Begin (Prerequisites)

  • Familiarity with decimal place values (units, tens, hundreds, thousands, powers of 10).
  • Basic arithmetic operations (addition, subtraction, multiplication, division).
  • Understanding of electrical switches (ON = 1, OFF = 0).

What You Will Learn (Core Objectives)

  • Differentiate between Decimal (Base 10), Binary (Base 2), Octal (Base 8), and Hexadecimal (Base 16) number systems.
  • Execute step-by-step conversions between any number system (e.g., Decimal to Binary, Binary to Hexadecimal).
  • Perform binary arithmetic including binary addition with carries and subtraction using 1’s and 2’s complements.
  • Construct truth tables for Boolean propositions and understand logic gates: AND, OR, NOT, NAND, NOR, XOR, XNOR.
  • Explain why NAND and NOR are termed "Universal Logic Gates" and construct other gates using them.
  • Prove De Morgan’s Laws algebraically and through truth table verification.

Chapter Roadmap & Progression

1 1. Digital Positional Number System...
2 2. Inter-System Conversion Algorith...
3 3. Binary Arithmetic & 1’s and 2’s...
4 4. Boolean Algebra, Logic Gates & D...

Complete Concept Guide (100% Curriculum Coverage)

1. Digital Positional Number Systems (Base 10, 2, 8, and 16)

A Positional Number System represents numerical values where the magnitude of each digit depends on its face value, the base (radix) of the system, and its position relative to the radix point. The general formula for a value is $N = \sum (d_i \times B^i)$, where $B$ is the base and $d_i$ is the digit at position $i$.

Number System Base (Radix) Permissible Digits / Symbols Primary Computing Application
Decimal Base 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Human everyday mathematics and financial calculations.
Binary Base 2 0, 1 Machine-level logic, CPU register storage, memory flip-flops.
Octal Base 8 0, 1, 2, 3, 4, 5, 6, 7 Short-hand representation of 3-bit binary strings; UNIX file permissions (e.g., chmod 755).
Hexadecimal Base 16 0–9, and A=10, B=11, C=12, D=13, E=14, F=15 RAM memory addresses, HTML/CSS web color codes (#FFFFFF), MAC hardware addresses.

2. Inter-System Conversion Algorithms & Grouping Tricks

Converting between different bases is a systematic algorithmic process:

  • Decimal to Any Base ($B$): Repeatedly divide the integer decimal number by $B$. Record the remainder at each step. Continue dividing until the quotient becomes 0. Write down the remainders in reverse order (from bottom to top, i.e., from Most Significant Bit [MSB] to Least Significant Bit [LSB]).
  • Any Base ($B$) to Decimal: Multiply each digit by its positional weight $B^p$ (where $p = 0$ for the rightmost digit, $p = 1$ for the next, etc.), and calculate the algebraic sum of all products.
  • Binary to Octal (3-Bit Grouping): Group the binary bits into triplets starting from right to left. Replace each 3-bit cluster with its octal equivalent ($000_2 = 0_8$ up to $111_2 = 7_8$).
  • Binary to Hexadecimal (4-Bit Grouping / Nibble): Group the binary bits into quartets (nibbles) from right to left. Replace each 4-bit cluster with its corresponding Hex symbol ($0000_2 = 0_{16}$ up to $1111_2 = \text{F}_{16}$).

3. Binary Arithmetic & 1’s and 2’s Complement Subtraction

Computers perform addition using binary logic rules. Subtraction is internally achieved by converting the subtrahend into its 2’s complement and adding it to the minuend:

Binary Addition Rules

• $0 + 0 = 0$ (Carry = 0)
• $0 + 1 = 1$ (Carry = 0)
• $1 + 0 = 1$ (Carry = 0)
• $1 + 1 = 0$ (Carry = 1)
• $1 + 1 + 1 = 1$ (Carry = 1)

Complements in Digital Systems:

  • 1’s Complement: Obtained simply by inverting every bit: change all $0$s to $1$s, and all $1$s to $0$s.
  • 2’s Complement: Calculated by adding 1 to the 1’s complement: $\text{2’s Complement} = \text{1’s Complement} + 1$.
  • Subtraction using 2’s Complement: To compute $A - B$: Find the 2’s complement of $B$, add it to $A$. If an end-carry is generated, discard it (the result is positive). If no carry is generated, take the 2’s complement of the answer and attach a negative sign.

4. Boolean Algebra, Logic Gates & De Morgan’s Theorems

Boolean Algebra, formulated by English mathematician George Boole, is a two-valued algebraic system dealing with binary variables ($1 = \text{True}$, $0 = \text{False}$) and logical operations.

Logic Gate Boolean Operator Boolean Expression Output Behavior
AND Gate Logical Conjunction ($\cdot$) $Y = A \cdot B$ Output is 1 ONLY IF both inputs $A$ and $B$ are 1.
OR Gate Logical Disjunction ($+$) $Y = A + B$ Output is 1 IF AT LEAST ONE input is 1; 0 only if both are 0.
NOT Gate (Inverter) Logical Inversion ($\overline{A}$) $Y = \overline{A}$ Single input; inverts $1 \to 0$ and $0 \to 1$.
NAND Gate (Universal) NOT-AND $Y = \overline{A \cdot B}$ Opposite of AND; output is 0 only if both inputs are 1.
NOR Gate (Universal) NOT-OR $Y = \overline{A + B}$ Opposite of OR; output is 1 only if both inputs are 0.
XOR Gate (Exclusive OR) Exclusive OR ($\oplus$) $Y = A\overline{B} + \overline{A}B$ Output is 1 IF INPUTS ARE DIFFERENT (one 0 and one 1); 0 if identical.
De Morgan’s Laws:
1. First Law: $\overline{A + B} = \overline{A} \cdot \overline{B}$ (The complement of a sum is equal to the product of individual complements).
2. Second Law: $\overline{A \cdot B} = \overline{A} + \overline{B}$ (The complement of a product is equal to the sum of individual complements).

Key Programming Syntax, Statements & Translator Rules

General Positional Base Expansion
$$N = d_n * B^n + ... + d_1 * B^1 + d_0 * B^0$$
Converts any integer representation in Base B into its standard Decimal equivalent.
2’s Complement Equation
2’s Complement = (1’s Complement) + 1
Standard microchip method for representing negative signed integers and executing subtraction.
De Morgan’s First Theorem
!(A + B) = !A * !B
NOR gate is logically equivalent to an AND gate with inverted inputs (bubbled AND).
De Morgan’s Second Theorem
!(A * B) = !A + !B
NAND gate is logically equivalent to an OR gate with inverted inputs (bubbled OR).
XOR Boolean Expansion
A ^ B = (A * !B) + (!A * B)
Essential logic gate utilized in digital binary Half-Adders and Full-Adders.

Conceptual Solved Examples & Case Studies

Example 1
Question 1: Convert the Decimal number $(117)_{10}$ into its equivalent (a) Binary, (b) Octal, and (c) Hexadecimal representations, showing step-by-step division.
Step-by-Step Solution:
Answer: (a) Decimal to Binary (Divide by 2): 117 / 2 = 58 with remainder 1 (LSB) 58 / 2 = 29 with remainder 0 29 / 2 = 14 with remainder 1 14 / 2 = 7 with remainder 0 7 / 2 = 3 with remainder 1 3 / 2 = 1 with remainder 1 1 / 2 = 0 with remainder 1 (MSB) Reading remainders from bottom to top: (117)10 = (1110101)2. (b) Decimal to Octal (Divide by 8): 117 / 8 = 14 with remainder 5 (LSB) 14 / 8 = 1 with remainder 6 1 / 8 = 0 with remainder 1 (MSB) Reading remainders from bottom to top: (117)10 = (165)8. (c) Decimal to Hexadecimal (Divide by 16): 117 / 16 = 7 with remainder 5 (LSB) 7 / 16 = 0 with remainder 7 (MSB) Reading remainders from bottom to top: (117)10 = (75)16. Verification: (7 * 16^1) + (5 * 16^0) = 112 + 5 = 117. Perfect match!
Example 2
Question 2: Perform binary addition: $(11011)_2 + (10110)_2$. Show carries generated at each column step.
Step-by-Step Solution:

Answer: We align the numbers by bit positions: Carry: 1 1 1 1 0 1 1 0 1 1 (= 27 in decimal) + 1 0 1 1 0 (= 22 in decimal) --------------- 1 1 0 0 0 1 (= 49 in decimal)

Step-by-step bit addition:

  • Column 0 (2^0): 1 + 0 = 1 (Carry = 0)
  • Column 1 (2^1): 1 + 1 = 0 (Carry = 1)
  • Column 2 (2^2): 0 + 1 + carry 1 = 0 (Carry = 1)
  • Column 3 (2^3): 1 + 0 + carry 1 = 0 (Carry = 1)
  • Column 4 (2^4): 1 + 1 + carry 1 = 1 (Carry = 1)
  • Column 5 (2^5): Bring down carry 1. Result: (110001)2. Decimal check: 27 + 22 = 49. (32 + 16 + 1 = 49). Fully verified.
Example 3
Question 3: Perform subtraction $(1100)_2 - (1001)_2$ using the 2’s complement method.
Step-by-Step Solution:
Answer: Minuend A = 1100 (which is 12 in decimal) Subtrahend B = 1001 (which is 9 in decimal) Step 1: Find 1’s complement of B (1001): Invert bits -> 0110. Step 2: Find 2’s complement of B: Add 1 to 1’s complement: 0 1 1 0 + 1 --------- 0 1 1 1 (= 2’s complement of 1001) Step 3: Add 2’s complement of B to Minuend A: 1 1 0 0 + 0 1 1 1 --------- 1 0 0 1 1 Step 4: Analyze end-carry: An overflow carry bit (1) was generated at the 5th position. In 2’s complement subtraction, this end-carry signifies that the result is POSITIVE. We simply discard the end-carry. Remaining bits: 0011. Result: (1100)2 - (1001)2 = (0011)2. Decimal check: 12 - 9 = 3. Binary 0011 = 3. Fully correct.
Example 4
Question 4: Construct a complete Truth Table to prove De Morgan’s First Law: $\overline{A + B} = \overline{A} \cdot \overline{B}$.
Step-by-Step Solution:

Answer: We construct the 4-row truth table for two binary variables A and B:

A B A + B NOT(A + B) [LHS] NOT(A) NOT(B) NOT(A) * NOT(B) [RHS]
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

Analysis: Comparing Column 4 (LHS: NOT(A + B)) with Column 7 (RHS: NOT(A) * NOT(B)):

  • For (0,0): LHS = 1, RHS = 1
  • For (0,1): LHS = 0, RHS = 0
  • For (1,0): LHS = 0, RHS = 0
  • For (1,1): LHS = 0, RHS = 0

Since Column 4 is identical to Column 7 for all possible truth assignments, De Morgan’s First Law is rigorously proved.

Example 5
Question 5: Why are NAND and NOR gates called "Universal Logic Gates"? Demonstrate how an AND gate can be constructed using only NAND gates.
Step-by-Step Solution:

Answer:

  1. Definition of Universal Gates: NAND and NOR gates are termed "Universal Gates" because any basic Boolean logic operation (AND, OR, NOT) and any complex digital circuit (such as adders, multiplexers, and processors) can be implemented using exclusively NAND gates or exclusively NOR gates without requiring any other type of gate. This dramatically streamlines microchip fabrication and reduces production costs.

  2. Realizing an AND Gate using only NAND Gates:

  • Recall that an AND gate is logically equivalent to a NAND gate followed by a NOT gate: A * B = NOT(NOT(A * B)).
  • We can create a NOT gate from a NAND gate by tying both inputs together: NOT(X) = X NAND X.
  • Implementation: Step 1: Feed inputs A and B into the first NAND gate. Output 1 = NOT(A * B). Step 2: Feed Output 1 into both inputs of a second NAND gate acting as an inverter. Output 2 = NOT(Output 1) = NOT(NOT(A * B)) = A * B. Thus, two NAND gates connected in series perfectly realize an AND gate!

Common Misconceptions & Examiner Traps

Common Misconception

Reading remainders from top-to-bottom instead of bottom-to-top during decimal-to-binary conversion.

Scientific Reality & Correction

The first remainder produced corresponds to the Least Significant Bit (LSB / 2^0), while the final remainder corresponds to the Most Significant Bit (MSB). Always read remainders upward from bottom to top.

Common Misconception

Confusing the 1’s complement with the 2’s complement.

Scientific Reality & Correction

1’s complement is simply inverting the bits (0 -> 1, 1 -> 0). 2’s complement requires adding binary 1 to that 1’s complement (2’s Comp = 1’s Comp + 1).

Common Misconception

Assuming that an XOR gate produces an output of 1 when both inputs are 1.

Scientific Reality & Correction

In an Exclusive OR (XOR) gate, identical inputs yield 0 (i.e., 0 XOR 0 = 0, and 1 XOR 1 = 0). An output of 1 is generated ONLY when inputs are different (0 XOR 1 = 1, and 1 XOR 0 = 1).

Visual Learning & Conceptual Map

Number Systems & Boolean Logic Circuit Architecture Bases 2, 8, 10, 16 | Binary Arithmetic & Universal Logic Gates Matrix The 4 Fundamental Number Systems DECIMAL (Base 10) Digits: 0, 1, 2 ... 9 Weights: 10⁰, 10¹, 10² BINARY (Base 2) Bits: 0, 1 Weights: 2⁰, 2¹, 2², 2³ OCTAL (Base 8) Digits: 0, 1 ... 7 Grouping: 3-Bit clusters HEXADECIMAL (16) 0–9 and A, B, C, D, E, F Grouping: 4-Bit nibbles Logic Gates Truth Behavior AND Gate (A • B): 1 only if both A=1 and B=1 OR Gate (A + B): 1 if at least one input is 1 NOT Gate (!A): Inverter: 0 becomes 1; 1 becomes 0 NAND Gate (Universal): !(A • B) | 0 only if both inputs are 1 XOR Gate (A ^ B): 1 if inputs are DIFFERENT (0,1 or 1,0) De Morgan’s Laws & Binary Arithmetic Rules: • First Theorem: !(A + B) = !A • !B (Break the line, change the sign: NOR = Bubbled AND) • Second Theorem: !(A • B) = !A + !B (NAND = Bubbled OR) • Binary Addition: 1 + 1 = 10 (0 with carry 1) • 2’s Complement: 1’s Comp + 1 (Used in Subtraction)

Chapter Summary & 10 Key Takeaways

Takeaway 1
  1. Positional Number Systems calculate value using digit face value multiplied by its base raised to the positional index: N = sum(d * Base^p).
Takeaway 2
  1. Decimal has Base 10 (digits 0–9); Binary has Base 2 (digits 0, 1); Octal has Base 8 (0–7); Hexadecimal has Base 16 (0–9 and A–F).
Takeaway 3
  1. Decimal integers are converted to any base by repeated division by the target radix and reading remainders upward from LSB to MSB.
Takeaway 4
  1. Direct conversions between Binary and Octal use 3-bit groupings (triplets); Binary to Hexadecimal uses 4-bit groupings (nibbles).
Takeaway 5
  1. In binary addition: 0+0=0, 0+1=1, 1+0=1, 1+1=0 (carry 1), and 1+1+1=1 (carry 1).
Takeaway 6
  1. The 1’s complement of a binary number is formed by flipping all bits; the 2’s complement is obtained by adding 1 to the 1’s complement.
Takeaway 7
  1. Microprocessors execute binary subtraction by adding the 2’s complement of the subtrahend to the minuend.
Takeaway 8
  1. An AND gate outputs 1 only when all inputs are 1; an OR gate outputs 1 when at least one input is 1; a NOT gate inverts its single input.
Takeaway 9
  1. NAND and NOR are Universal Gates capable of creating all other logic gates (AND, OR, NOT) independently.
Takeaway 10
  1. De Morgan’s Laws state that !(A + B) = !A • !B, and !(A • B) = !A + !B, simplifying complex digital switching logic.

Check Your Understanding (Diagnostic Practice Questions)

Diagnostic questions testing core conceptual clarity. Answers are hidden initially — solve each problem first, then click to reveal the step-by-step verified solution.

1
What is the hexadecimal equivalent of binary (1101 1010)2?
Reveal Answer & Explanation
Answer: DA in Base 16
Group into 4-bit nibbles: 1101 = 13 which is D in hex; 1010 = 10 which is A in hex. Therefore, (11011010)2 = (DA)16.
2
What is the 2’s complement of the 4-bit binary number 1010?
Reveal Answer & Explanation
Answer: 0110
Step 1: 1’s complement of 1010 is 0101. Step 2: Add 1: 0101 + 1 = 0110.
3
Which two logic gates are universally capable of constructing any digital logic circuit?
Reveal Answer & Explanation
Answer: NAND and NOR gates
Both NAND and NOR gates are universal gates because their combinations can reproduce the behavior of NOT, AND, and OR gates.
4
In an XOR gate, what is the output when both inputs A and B are 1?
Reveal Answer & Explanation
Answer: 0 (False)
An XOR (Exclusive OR) gate outputs 1 ONLY when inputs differ. When both inputs are identical (1 and 1, or 0 and 0), the output is 0.
5
State De Morgan’s Second Law in Boolean algebra notation.
Reveal Answer & Explanation
Answer: !(A • B) = !A + !B
The complement of a logical product (NAND) is equal to the logical sum of individual complements (bubbled OR).
Finished Studying This Chapter?
READY TO PRACTICE?

Timed CBT Practice Tests (Exam Simulator)

Put your concepts to the test with official curriculum-aligned Foundation and Advanced practice tests. Get instant accuracy scores, time metrics, and step-by-step verified explanations.