Logic Gates

The physical building blocks used to implement Boolean expressions as circuits.

Logic Gates

Logic Gates digital electronics के basic building blocks हैं। ये binary input signals पर logical operations perform करते हैं और एक binary output देते हैं। Binary system में केवल दो values होती हैं: 0 (LOW/OFF) और 1 (HIGH/ON)

Logic gates का उपयोग computers, calculators, digital watches, communication systems, processors और अन्य digital electronic devices में किया जाता है।

Basic Idea: Logic Gate → Binary Input → Logical Operation → Binary Output

What is a Logic Gate?

Logic gate एक electronic circuit है जो एक या अधिक binary inputs को लेकर एक logical rule के अनुसार output generate करता है। प्रत्येक gate का अपना specific logical function होता है।

उदाहरण के लिए, AND gate तभी output 1 देता है जब उसके सभी inputs 1 हों।

Types of Logic Gates

मुख्य logic gates निम्नलिखित हैं:

Gate Symbol Basic Operation
AND · Multiplication / AND
OR + Addition / OR
NOT ' Inversion
NAND NOT-AND AND followed by NOT
NOR NOT-OR OR followed by NOT
XOR Exclusive OR
XNOR Exclusive NOR

Binary Logic

Digital logic में binary values का उपयोग किया जाता है:

Binary Value Common Meaning
0 LOW / OFF / False
1 HIGH / ON / True

AND Gate

AND gate का output तभी 1 होता है जब सभी inputs 1 हों। यदि किसी भी input की value 0 है, तो output 0 होगा।

Boolean expression:

Y = A · B

या programming में इसे logical AND के रूप में represent किया जा सकता है:

#include <iostream>
using namespace std;

int main()
{
    bool A = true;
    bool B = true;

    bool Y = A && B;

    cout << "AND Output = " << Y;

    return 0;
}
Output:
AND Output = 1

AND Gate Truth Table

A B Y = A·B
0 0 0
0 1 0
1 0 0
1 1 1

OR Gate

OR gate का output 1 होता है यदि कम से कम एक input 1 हो। इसका output केवल तभी 0 होता है जब सभी inputs 0 हों।

Boolean expression:

Y = A + B

C++ में:

#include <iostream>
using namespace std;

int main()
{
    bool A = false;
    bool B = true;

    bool Y = A || B;

    cout << "OR Output = " << Y;

    return 0;
}
Output:
OR Output = 1

OR Gate Truth Table

A B Y = A+B
0 0 0
0 1 1
1 0 1
1 1 1

NOT Gate

NOT gate को Inverter भी कहा जाता है। यह input को उलट देता है। यदि input 0 है तो output 1 होगा और यदि input 1 है तो output 0 होगा।

Boolean expression:

Y = A'

C++ में:

#include <iostream>
using namespace std;

int main()
{
    bool A = true;

    bool Y = !A;

    cout << "NOT Output = " << Y;

    return 0;
}
Output:
NOT Output = 0

NOT Gate Truth Table

A Y = A'
0 1
1 0

NAND Gate

NAND gate, AND gate का complemented form है। इसका output AND gate के output का inverse होता है। NAND gate का output केवल तब 0 होता है जब सभी inputs 1 हों।

Boolean expression:

Y = (A · B)'

C++ में:

#include <iostream>
using namespace std;

int main()
{
    bool A = true;
    bool B = true;

    bool Y = !(A && B);

    cout << "NAND Output = " << Y;

    return 0;
}
Output:
NAND Output = 0

NAND Gate Truth Table

A B Y = (A·B)'
0 0 1
0 1 1
1 0 1
1 1 0

NOR Gate

NOR gate, OR gate का complemented form है। इसका output OR gate के output का inverse होता है। NOR gate का output केवल तब 1 होता है जब सभी inputs 0 हों।

Boolean expression:

Y = (A + B)'

C++ में:

#include <iostream>
using namespace std;

int main()
{
    bool A = false;
    bool B = false;

    bool Y = !(A || B);

    cout << "NOR Output = " << Y;

    return 0;
}
Output:
NOR Output = 1

NOR Gate Truth Table

A B Y = (A+B)'
0 0 1
0 1 0
1 0 0
1 1 0

XOR Gate

XOR का पूरा नाम Exclusive OR है। XOR gate का output 1 तब होता है जब दोनों inputs अलग-अलग हों। यदि दोनों inputs समान हों तो output 0 होता है।

Boolean expression:

Y = A ⊕ B

दो variables के लिए:

Y = A'B + AB'

C++ में XOR को अलग-अलग logical operations से represent किया जा सकता है:

#include <iostream>
using namespace std;

int main()
{
    bool A = true;
    bool B = false;

    bool Y = (A && !B) || (!A && B);

    cout << "XOR Output = " << Y;

    return 0;
}
Output:
XOR Output = 1

XOR Gate Truth Table

A B Y = A⊕B
0 0 0
0 1 1
1 0 1
1 1 0

XNOR Gate

XNOR का पूरा नाम Exclusive NOR है। यह XOR gate का complement है। इसका output 1 तब होता है जब दोनों inputs समान हों।

Boolean expression:

Y = (A ⊕ B)'

दो variables के लिए:

Y = AB + A'B'

C++ में:

#include <iostream>
using namespace std;

int main()
{
    bool A = true;
    bool B = true;

    bool xorResult = (A && !B) || (!A && B);
    bool Y = !xorResult;

    cout << "XNOR Output = " << Y;

    return 0;
}
Output:
XNOR Output = 1

XNOR Gate Truth Table

A B Y = (A⊕B)'
0 0 1
0 1 0
1 0 0
1 1 1

Comparison of Logic Gates

Gate Output 1 कब होगा?
AND जब सभी inputs 1 हों
OR जब कम से कम एक input 1 हो
NOT जब input 0 हो
NAND जब सभी inputs 1 न हों
NOR जब सभी inputs 0 हों
XOR जब inputs अलग हों
XNOR जब inputs समान हों

Universal Gates

NAND और NOR को Universal Gates कहा जाता है क्योंकि केवल NAND gates या केवल NOR gates की सहायता से सभी basic logic gates बनाए जा सकते हैं।

Using NAND to Create NOT Gate

यदि NAND gate के दोनों inputs को एक ही input से connect कर दिया जाए, तो वह NOT gate की तरह काम करता है।

Y = (A · A)'
  = A'

Using NOR to Create NOT Gate

इसी प्रकार NOR gate के दोनों inputs को एक ही input से connect करने पर NOT gate प्राप्त किया जा सकता है।

Y = (A + A)'
  = A'

AND Gate using NAND

NAND gate के output को दूसरे NAND gate में दोनों inputs के रूप में देने पर AND operation प्राप्त किया जा सकता है।

X = (A · B)'

Y = (X · X)'
  = X'
  = A · B

OR Gate using NOR

NOR gates की सहायता से OR operation भी प्राप्त किया जा सकता है:

X = (A + B)'

Y = (X + X)'
  = X'
  = A + B

Boolean Expressions and Logic Gates

Boolean expression को logic gates की सहायता से circuit में implement किया जा सकता है। उदाहरण के लिए:

Y = A·B + C

इस expression के लिए पहले A और B को AND gate से process किया जाता है और फिर प्राप्त output को C के साथ OR किया जाता है।

इसी प्रकार:

Y = (A + B) · C

में पहले A और B पर OR operation और फिर उसके result तथा C पर AND operation किया जाता है।

Logic Gates in C++

C++ में hardware logic gates directly नहीं बनते, लेकिन Boolean logic को C++ के logical operators से represent किया जा सकता है।

Logic Operation C++ Operator
AND &&
OR ||
NOT !
XOR ^ for integer/bitwise values

उदाहरण:

#include <iostream>
using namespace std;

int main()
{
    bool A = true;
    bool B = false;

    cout << "AND = " << (A && B) << endl;
    cout << "OR  = " << (A || B) << endl;
    cout << "NOT A = " << (!A) << endl;

    return 0;
}
Output:
AND = 0
OR = 1
NOT A = 0

Applications of Logic Gates

  • Computers और processors में।
  • Arithmetic circuits में।
  • Memory circuits में।
  • Control systems में।
  • Digital communication systems में।
  • Calculators और digital watches में।
  • Decision-making circuits में।
  • Data processing systems में।

Important Points

  • Logic gates digital circuits के fundamental building blocks हैं।
  • Digital logic में मुख्यतः 0 और 1 का उपयोग होता है।
  • AND gate का output तभी 1 होता है जब सभी inputs 1 हों।
  • OR gate का output तब 1 होता है जब कम से कम एक input 1 हो।
  • NOT gate input का complement देता है।
  • NAND, AND gate का complement है।
  • NOR, OR gate का complement है।
  • XOR का output inputs के अलग होने पर 1 होता है।
  • XNOR का output inputs के समान होने पर 1 होता है।
  • NAND और NOR universal gates हैं।
  • एक NAND या NOR gate configuration से NOT operation बनाया जा सकता है।
  • Logic gates का उपयोग digital electronic circuits में किया जाता है।

Board Focus

Exam में विशेष रूप से याद रखें:
AND → All inputs 1 → Output 1
OR → Any input 1 → Output 1
NOT → Input का complement
NAND → NOT of AND
NOR → NOT of OR
XOR → Inputs different → Output 1
XNOR → Inputs same → Output 1
NAND और NOR → Universal Gates

Board Important Questions

Very Short Answer Questions

Q1. Logic Gate क्या है?

Answer: Logic gate एक digital electronic circuit है जो binary inputs पर logical operation करके binary output देता है।

Q2. AND gate का output 1 कब होता है?

Answer: जब सभी inputs 1 हों।

Q3. OR gate का output 0 कब होता है?

Answer: जब सभी inputs 0 हों।

Q4. NOT gate को अन्य किस नाम से जाना जाता है?

Answer: Inverter.

Q5. NAND gate किस gate का complement है?

Answer: AND gate.

Q6. NOR gate किस gate का complement है?

Answer: OR gate.

Q7. XOR का full form क्या है?

Answer: Exclusive OR.

Q8. XNOR का output 1 कब होता है?

Answer: जब सभी inputs समान हों।

Q9. Universal gates कौन-कौन से हैं?

Answer: NAND और NOR.

Q10. NAND gate का output 0 कब होता है?

Answer: जब सभी inputs 1 हों।

Short Answer Questions

Q11. AND gate को truth table द्वारा समझाइए।

Answer: AND gate में output तभी 1 होता है जब सभी inputs 1 हों।

Q12. OR और XOR gate में अंतर बताइए।

Answer: OR gate में किसी भी एक input के 1 होने पर output 1 हो जाता है, जबकि XOR gate में output 1 तभी होता है जब inputs अलग-अलग हों।

Q13. NAND gate को Universal Gate क्यों कहा जाता है?

Answer: क्योंकि केवल NAND gates की सहायता से AND, OR और NOT सहित सभी basic logic gates बनाए जा सकते हैं।

Q14. NOR gate को Universal Gate क्यों कहा जाता है?

Answer: क्योंकि केवल NOR gates की सहायता से सभी basic logic gates बनाए जा सकते हैं।

Q15. XOR और XNOR में क्या अंतर है?

Answer: XOR का output 1 तब होता है जब inputs अलग हों, जबकि XNOR का output 1 तब होता है जब inputs समान हों।

Q16. Boolean expression Y = A·B का कौन-सा gate representation है?

Answer: AND gate.

Q17. Boolean expression Y = (A+B)' किस gate को represent करता है?

Answer: NOR gate.

Long Answer Questions

Q18. विभिन्न logic gates को truth tables सहित समझाइए।

Answer: AND, OR, NOT, NAND, NOR, XOR और XNOR प्रमुख logic gates हैं। प्रत्येक gate अलग logical operation perform करता है। दो-input gates की truth tables निम्न हैं:

A B AND OR NAND NOR XOR XNOR
0 0 0 0 1 1 0 1
0 1 0 1 1 0 1 0
1 0 0 1 1 0 1 0
1 1 1 1 0 0 0 1

Q19. NAND और NOR को Universal Gates क्यों कहा जाता है?

Answer: NAND और NOR gates से NOT, AND और OR जैसे basic gates बनाए जा सकते हैं। इसलिए इनके combination से किसी भी Boolean function को implement किया जा सकता है। इस कारण NAND और NOR को Universal Gates कहा जाता है।

Q20. NAND gate की सहायता से NOT और AND gates प्राप्त कीजिए।

Answer:

NOT:

Y = (A · A)'
  = A'


AND:

X = (A · B)'

Y = (X · X)'
  = A · B

Q21. NOR gate की सहायता से NOT और OR gates प्राप्त कीजिए।

Answer:

NOT:

Y = (A + A)'
  = A'


OR:

X = (A + B)'

Y = (X + X)'
  = A + B

Practice Questions

  1. Logic gate क्या है?
  2. Logic gates के प्रमुख प्रकार लिखिए।
  3. AND gate का truth table बनाइए।
  4. OR gate का truth table बनाइए।
  5. NOT gate का truth table बनाइए।
  6. NAND gate का truth table बनाइए।
  7. NOR gate का truth table बनाइए।
  8. XOR gate का truth table बनाइए।
  9. XNOR gate का truth table बनाइए।
  10. NAND और NOR को universal gates क्यों कहा जाता है?
  11. AND और OR gates में अंतर लिखिए।
  12. OR और XOR gates में अंतर लिखिए।
  13. XOR और XNOR gates में अंतर लिखिए।
  14. Boolean expression A·B किस gate को represent करता है?
  15. Boolean expression (A+B)' किस gate को represent करता है?
  16. Boolean expression A⊕B किस gate को represent करता है?
  17. NAND gate की सहायता से NOT gate बनाइए।
  18. NAND gates की सहायता से AND gate बनाइए।
  19. NOR gate की सहायता से NOT gate बनाइए।
  20. NOR gates की सहायता से OR gate बनाइए।

Quick Revision

  • AND: All inputs 1 → Output 1.
  • OR: Any input 1 → Output 1.
  • NOT: Input को invert करता है।
  • NAND: AND का complement.
  • NOR: OR का complement.
  • XOR: Different inputs → 1.
  • XNOR: Same inputs → 1.
  • Universal Gates: NAND और NOR.
One-Line Revision: Logic gates binary inputs पर logical operations perform करके binary output देते हैं और digital electronic circuits के fundamental building blocks होते हैं।
Lesson 31 of 37
On This Page