Class 11 Computer Science: Number System and Boolean Logic
Class 11 Computer Science - Number System and Boolean Logic
Number System and Boolean Logic
15 hours

Class 11 Computer Science – Unit 2: Number System and Boolean Logic

This unit provides a comprehensive overview of Number Systems and Boolean Logic, covering fundamental concepts of different number systems, their conversions, binary arithmetic, Boolean algebra, and logic gates. Understanding these concepts is crucial for computer science applications and forms the foundation of digital electronics and computer architecture.

Unit Information

Unit 2: Number System and Boolean Logic (15 hours)

Subject: Computer Science, Grade 11, NEB

Description: This guide provides complete notes covering number systems, binary arithmetic, Boolean algebra, logic gates, and Boolean laws as per NEB syllabus.

Credit: Important Notes

Detailed Unit Notes

2.1 Number System and Conversion

2.1.1 Decimal, Binary, Octal, Hexadecimal Number System & Conversion

A number system is a set of values used to represent different quantities and characters. It deals with numbers and their representation (base, exponent, and radix in different systems).

Categories of Number Systems:

  1. Positional number system – The value of a digit depends on its position in the number
  2. Non-positional number system – The value of a digit does not depend on its position
1. Decimal or Denary Number System
  • Most popular numbering system used in daily life
  • Contains ten digits (0, 1, 2, …, 9)
  • Also called base 10 number system
  • Subscripted by 10 or ‘D’
  • Example: 1510 or 15D
2. Binary Number System
  • Number system of computers – the “mother language” of computers
  • Consists of two digits (0 and 1)
  • Also called base 2 number system
  • Subscripted by 2 or ‘B’
  • Example: 10112 or 1011B
3. Octal Number System
  • Consists of 8 digits (0-7)
  • Also called base 8 number system
  • Subscripted by 8 or ‘O’
  • Example: 1268 or 126O
Conversion Table of Octal to Decimal and Binary
Octal Decimal Binary (421)
00000
11001
22010
33011
44100
55101
66110
77111
4. Hexadecimal Number System
  • Consists of 16 symbols: 10 digits (0-9) and 6 letters (A-F)
  • Also called base 16 number system
  • Subscripted by 16 or ‘H’
  • Example: 12AB16 or 12ABH
Conversion Table of Hexadecimal to Binary and Decimal (8421)
Hexadecimal Decimal Binary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111
Conversion of Number Systems

1. Decimal to Binary:

1510 = ?2

  2 | 15
  2 | 7  -- 1
  2 | 3  -- 1
    | 1  -- 1
                    

1510 = 11112

43.62510 = ?2

Integer part:

  2 | 43
  2 | 21 -- 1
  2 | 10 -- 1
  2 | 5  -- 0
  2 | 2  -- 1
    | 1  -- 0
                    

Fractional part:

  0.625 × 2 = 1.25 → 1
  0.25  × 2 = 0.5  → 0
  0.5   × 2 = 1.0  → 1
                    

43.62510 = 101011.1012

2. Decimal to Octal:

12310 = ?8

  8 | 123
  8 | 15  -- 3
    | 1   -- 7
                    

12310 = 1738

3. Decimal to Hexadecimal:

12310 = ?16

  16 | 123
     | 7   -- 11 (B)
                    

12310 = 7B16

4. Binary to Decimal:

10112 = ?10

= 1×23 + 0×22 + 1×21 + 1×20

= 8 + 0 + 2 + 1 = 1110

5. Binary to Octal (Group bits in 3s):

0101112 = ?8

010 | 111

2 | 7

0101112 = 278

6. Binary to Hexadecimal (Group bits in 4s):

11011101112 = ?16

0011 | 0111 | 0111

3 | 7 | 7

11011101112 = 37716

2.1.2 Calculation in Binary Addition and Subtraction

Binary Addition Rules:
A B Sum Carry
0000
0110
1010
1101
Examples of Binary Addition:

Example 1:

    1 1 1 0 1 0 1
  + 1 0 1 0 1 1 0
  ----------------
  1 1 0 0 1 0 1 1
                    

Example 2:

    1 0 1 0
  + 1 1 1 1
  ----------
  1 1 0 0 1
                    
Binary Subtraction Rules:
A B Difference Borrow
0000
0111
1010
1100
Examples of Binary Subtraction:

Example 1:

    1 0 1 1 0 1
  -   1 0 1 1 1
  --------------
      1 0 1 1 0
                    

Example 2:

    1 1 1 1 1
  - 1 0 0 0 1
  ------------
    0 1 1 1 0
                    

2.1.3 One’s and Two’s Complement Methods of Binary Subtraction

In computer systems, subtraction is not performed directly as arithmetic subtraction. It is performed using the technique called complement, which is essentially a process of repeated addition.

Types of Complement:
  1. r’s complement (e.g., 2’s or 10’s complement)
  2. (r-1)’s complement (e.g., 1’s or 9’s complement)
1’s Complement:

The 1’s complement of a binary number is obtained by subtracting each bit from 1. We can get the 1’s complement by simply replacing 1s with 0s and 0s with 1s.

Example: 1’s complement of 1010 is 0101

2’s Complement:

The 2’s complement of a binary number is obtained by adding binary 1 to the 1’s complement of the number.

Example:

  Binary number: 110110
  1's complement: 001001
  Add 1:        +      1
  2's complement: 001010
                    
Binary Subtraction using 1’s Complement:

Steps:

  1. Make both numbers have the same number of bits
  2. Determine the 1’s complement of the subtrahend
  3. Add the 1’s complement to the minuend
    • If there is an additional bit (carry) in the result after addition, remove it and add it to the result
    • If there is no carry, determine the 1’s complement of the result and prefix it with a negative (-) sign

Example: Subtract 1100002 from 11000002

  Minuend = 1100000
  Subtrahend = 110000
  
  Step 1: 1's complement of subtrahend: 001111
  Step 2: Add minuend and 1's complement:
      1100000
    + 0011111
    ---------
      1111111
  Step 3: No carry, so take 1's complement and add negative sign:
      1111111 → 0000000 → -0000000
                    
Binary Subtraction using 2’s Complement:

Steps:

  1. Make both numbers have the same number of bits
  2. Determine the 2’s complement of the subtrahend
  3. Add the 2’s complement to the minuend
    • If there is an additional bit in the result after addition, neglect the carry and the remaining bits are the required answer
    • If there is no additional bit, determine the 2’s complement of the result and prefix it with a negative (-) sign

Example: Subtract 1012 from 1102

  Minuend = 110
  Subtrahend = 101
  
  Step 1: 2's complement of subtrahend:
      101 → 1's comp: 010 → 2's comp: 011
  Step 2: Add minuend and 2's complement:
      110
    + 011
    -----
    1 001
  Step 3: Carry occurs, so remove carry: 001
                    

Result: 0012

2.2 Logic Function and Boolean Algebra

2.2.1 Introduction to Boolean Algebra

Boolean algebra is the algebra of logic that deals with binary variables and logical operations. It is one of the most basic methods for analysis of logic. It was developed by the English mathematician George Boole.

In Boolean algebra, the variables are permitted to have only two values: true and false, usually written as one (1) or zero (0) respectively.

Key Characteristics:

  • Deals with binary variables (0 and 1)
  • Uses logical operations (AND, OR, NOT)
  • Forms the foundation of digital circuit design
  • Essential for computer logic and programming

2.2.2 Boolean Values, Truth Table, Boolean Expression and Function

Boolean Values:

Boolean algebra uses only two values:

  • 0 (False) – represents logical false, low voltage, off state
  • 1 (True) – represents logical true, high voltage, on state
Truth Table:

A truth table represents the input-output relationship of a binary variable logic gate. It shows the relationship between all inputs and outputs in a tabular format.

The number of rows in a truth table is equal to 2n, where n is the number of input variables.

Example: OR Gate Truth Table
Input A Input B Output C = A+B
000
011
101
111
Boolean Expression:

A Boolean expression is an algebraic expression formed using Boolean constants, Boolean variables, and Boolean operators.

Examples:

  • F = A + B (OR operation)
  • F = A · B (AND operation)
  • F = A’ (NOT operation)
Boolean Function:

A Boolean function is a function that maps Boolean inputs to Boolean outputs. It can be represented using:

  • Boolean expressions
  • Truth tables
  • Logic diagrams

2.2.3 Logic Gates – AND, OR, NOT, NAND, NOR, XOR and XNOR

A logic gate is an electronic circuit that operates on one or more input signals to produce an output. It is a building block of digital circuits.

Types of Logic Gates:
  1. Fundamental or Basic Gates
    • OR gate
    • AND gate
    • NOT gate
  2. Universal Gates
    • NOR gate
    • NAND gate
  3. Other Gates
    • Exclusive OR gate (X-OR)
    • Exclusive NOR gate (X-NOR)
Logic Gates with Diagrams:
AND Gate

Produces a high (1) output only when all inputs are 1.

A B C
C = A · B
AND Gate Truth Table
A B C = A·B
000
010
100
111
OR Gate

Produces a high (1) output when any input is 1.

A B C
C = A + B
OR Gate Truth Table
A B C = A+B
000
011
101
111
NOT Gate

Produces the complement (inverse) of the input.

A C
C = A’ or C = Ā
NOT Gate Truth Table
A C = A’
01
10
NAND Gate

Complement of AND gate. Produces 0 only when all inputs are 1.

A B C
C = (A · B)’
NAND Gate Truth Table
A B C = (A·B)’
001
011
101
110
NOR Gate

Complement of OR gate. Produces 1 only when all inputs are 0.

A B C
C = (A + B)’
NOR Gate Truth Table
A B C = (A+B)’
001
010
100
110
XOR Gate

Produces 1 when inputs are different.

A B C
C = A ⊕ B
XOR Gate Truth Table
A B C = A ⊕ B
000
011
101
110
XNOR Gate

Produces 1 when inputs are the same.

A B C
C = (A ⊕ B)’
XNOR Gate Truth Table
A B C = (A ⊕ B)’
001
010
100
111

2.2.4 Laws of Boolean Algebra

Boolean algebra follows specific laws that help in simplifying Boolean expressions and designing efficient digital circuits.

1. De Morgan’s Laws
  • First Theorem: (x+y)’ = x’ · y’
  • Second Theorem: (x·y)’ = x’ + y’
2. Associative Law
  • (A+B)+C = A+(B+C)
  • (A·B)·C = A·(B·C)
3. Distributive Law
  • A·(B+C) = A·B + A·C
  • A+(B·C) = (A+B)·(A+C)
4. Commutative Law
  • A+B = B+A
  • A·B = B·A
5. Complement Law
  • A + Ā = 1
  • A · Ā = 0
6. Identity Law

OR Operations:

  • A + 1 = 1
  • A + A = A
  • A + Ā = 1
  • A + 0 = A

AND Operations:

  • A · 1 = A
  • A · A = A
  • A · Ā = 0
  • A · 0 = 0

2.2.5 Statement and Verification of Laws of Boolean Algebra

Verification of De Morgan’s First Theorem: (x+y)’ = x’ · y’
Truth Table Verification
x y x+y (x+y)’ x’ y’ x’·y’
0001111
0110100
1010010
1110000

Since columns for (x+y)’ and x’·y’ are identical, the law is verified.

Verification of Distributive Law: A·(B+C) = A·B + A·C
Truth Table Verification
A B C B+C A·(B+C) A·B A·C A·B + A·C
00000000
00110000
01010000
01110000
10000000
10111011
11011101
11111111

Since columns for A·(B+C) and A·B + A·C are identical, the law is verified.

Practice Questions and Answers

Question 1: Convert the following decimal numbers into octal and hexadecimal:

a) 756

Solution:

Octal conversion:

  8 | 756
  8 | 94  -- 4
  8 | 11  -- 6
    | 1   -- 3
                

75610 = 13648

Hexadecimal conversion:

  16 | 756
  16 | 47  -- 4
    | 2   -- 15 (F)
                

75610 = 2F416

Question 2: Convert 33310 into hexadecimal and then to binary

Solution:

Hexadecimal conversion:

  16 | 333
  16 | 20  -- 13 (D)
    | 1   -- 4
                

33310 = 14D16

Binary conversion from hexadecimal:

1 | 4 | D

0001 | 0100 | 1101

14D16 = 1010011012

Question 3: Convert ABC16 into binary number system

Solution:

A | B | C

1010 | 1011 | 1100

ABC16 = 1010101111002

Question 4: Convert 1110112 into base 16

Solution:

Binary: 0011 1011

Hexadecimal: 3 B

1110112 = 3B16

Question 5: Convert A5B16 into decimal number

Solution:

A5B16 = A×162 + 5×161 + B×160

= 10×256 + 5×16 + 11×1

= 2560 + 80 + 11 = 2651

A5B16 = 265110

Question 6: Perform binary arithmetic operations

a) Addition: 1001 + 1100

    1001
  + 1100
  -------
   10101
                

b) Subtraction: 1100 – 0111

    1100
  - 0111
  -------
    0101
                

c) Multiplication: 1100 × 11

    1100
  ×   11
  -------
    1100
   1100
  -------
  100100
                

Question 7: Verify De Morgan’s Second Theorem using truth table

Theorem: (x·y)’ = x’ + y’

Truth Table Verification
x y x·y (x·y)’ x’ y’ x’ + y’
0001111
0101101
1001011
1110000

Since columns for (x·y)’ and x’ + y’ are identical, the theorem is verified.

×

Disclaimer

The educational materials provided on this website are intended as supplementary resources to support your learning journey. These study materials are sample documents designed to help students understand complex concepts in Computer Science.

We have made every effort to ensure the accuracy of the content. However, we recommend students to refer to standard textbooks and consult with professors for authoritative explanations. These materials should be used as references only.

Scroll to Top