# Logic Gates

**Logic Gates**: In this tutorial, we are going to learn about the **logic gates** like **AND Gate, OR Gate, NOT Gate, Exclusive-Or Gate/XOR Gate, and Exclusive-NOR Gate/XNOR Gate**.

Submitted by Saurabh Gupta, on November 13, 2019

**Logic Gates** are the fundamental building blocks of a digital system. The name Logic Gates has been derived from the fact that the device should be able to make decisions on its own. It should be able to distinguish different output levels, for example, one output level is produced when some level of input is present and other output level is produced when another set of input is provided.

Input and Output of logic gates occur in only two states either ON/High/True or OFF/Low/False. We simply represent these in numerical form as 1 and 0 respectively.

A Truth Table contains all possible combinations of inputs and their possible outputs. It shows how the logic circuit's output responds to various combinations of logic levels at the inputs.

There are just three basic types of gates - **AND Gate**, **OR Gate**, and **NOT Gate**. Additionally, we have two more gates namely, **XOR Gate** and **XNOR Gate**.

### 1) AND Gate

An **AND Gate** may have two or more inputs. The output of **AND Gate** will be 1 when all of its inputs are in state 1. The output will be in 0 states if even any one of its inputs is in state 0. Logic operation of **AND Gate** is given as **Y= A.B**.

**Symbol and Truth table for AND Gate:**

### 2) OR Gate

An **OR Gate** may also have two or more inputs. The output of **OR Gate** will be 1 when any of its inputs are in state 1. The output will be in 0 state, if all of its inputs are in state 0. Logic operation of **OR Gate** is given as **Y = A+B**.

### 3) NOT Gate

A **NOT Gate** is used for complementing the input provided. If the input will be high then output will be low and vice-versa. Logic operation of **NOT Gate** is given as: **Y=A'/A** (provided A is the input) which is read as A compliment.

**Symbol and Truth table for NOT Gate:**

### 4) Exclusive-Or Gate/XOR Gate

An **XOR Gate** has two inputs. The output of **XOR Gate** will be 1 when and only one of its inputs is provided high state (1). The output will be in 0 state, if both of its inputs are in logic state 0 or logic state 1. Logic operation of **XOR Gate** is given as: **Y= AB + AB = A⊕B**.

### 5) Exclusive-NOR Gate/XNOR Gate

An **XNOR Gate** has two inputs. The output of **XNOR Gate** will be 1 when and when both of its inputs are provided either low state (0) or high state (1). The output will be in 0 state, when one of its inputs is in logic state 0 and another in logic state 1. Logic operation of **XNOR Gate** is given as **Y= AB + AB = A⨀B**.

Related Tutorials

- Number systems and their representation
- Conversion of Decimal Number System into Binary Number System
- Conversion of Decimal Number System into Octal Number System
- Conversion of Decimal Number System into Hexadecimal Number System
- Conversion of Binary Number System to Decimal Number System
- Conversion of Binary Number System into Octal Number System
- Conversion of Binary Number System into Hexadecimal Number System
- Conversion of Octal Number System to Binary, Decimal and Hexadecimal Number Systems
- Conversion of Hexadecimal Number System to Binary, Octal and Decimal Number Systems
- Binary Addition and Subtraction
- Binary Multiplication and Division
- Signed Representation of Binary Numbers
- Floating Point Representation of Binary Numbers
- r's and (r-1)'s Complement of Numbers
- Binary Coded Decimal (BCD Code) and its addition
- Error Detecting Codes
- Excess-3 (XS-3) Code and Gray Code
- Universal Logic Gates (NAND, NOR)
- Duality Principle and Rules for Reduction of Boolean Expressions
- Axioms and Laws of Boolean Algebra
- Realization of Boolean expressions using Basic Logic Gates
- Realization of Boolean Expressions using only Universal Gates
- Solved Examples on Reduction of Boolean Expression
- Karnaugh Maps (K-Maps)
- POS and SOP form representation of a Boolean Function
- Min and Max Terms Notation in Boolean Algebra

- Mapping of expressions on K-Map and Encircling of groups
- Karnaugh Maps with Don't Care Conditions
- Combinational Circuit | Digital Electronics
- Designing of Half-Adder, Full Adder and making Full Adder using Half Adder
- Designing of Half Subtractor and Full Subtractor
- N-bit Parallel Adders (4-bit Binary Adder and Subtractor)
- Construction of Code Converters
- SR Latch in Digital Electronics
- Sequential Circuits in Digital Electronics
- Concept of Read Only Memory (ROM) in Digital Electronics
- Concept of Random Access Memory (RAM) in Digital Electronics
- Conversion of Flip Flops
- Solved Examples on Conversion of Flip-Flops
- Programmable Array Logic (PALs)
- Programmable Logic Array (PLAs)
- Magnetic Memories
- Introduction to JK Flip Flop
- Race Around Condition in JK Flip Flop and T-Flip Flop
- Master-Slave JK Flip Flop
- Logic Devices and Concept of PROM
- Designing of Asynchronous Counters
- Designing of Synchronous Counters
- Examples of Designing of Synchronous Mod-N Counters
- Examples of Designing of Arbitrary Sequence Counters and Bidirectional Counter
- Designing of Comparators

What's New

- C Language MCQs
- Python MCQs
- Perl MCQs
- MongoDB MCQs
- Java MCQs
- C# MCQs
- Scala MCQs
- Blockchain MCQs
- AutoCAD MCQs
- PHP MCQs
- JavaScript MCQs
- jQuery MCQs
- ReactJS MCQs
- AngularJS MCQs
- JSON MCQs
- Ajax MCQs
- SASS MCQs
- HTML MCQs
- Advanced CSS MCQs
- CSS MCQs
- OOPs MCQs
- PL/SQL MCQs
- SQL MCQs
- Oracle MCQs
- SQLite MCQs
- MS Word MCQs
- Software Engineering MCQs
- Operating System MCQs
- Data Analytics and Visualization MCQs
- MIS MCQs
- Linux MCQs
- WordPress MCQs
- Blogging MCQs

- Energy & Environment Engineering MCQs
- Project Management MCQs
- Marketing MCQs
- Generally Accepted Accounting Principles MCQs
- Bills of Exchange MCQs
- Business Environment MCQs
- Sustainable Development MCQs
- Marginal Costing and Absorption Costing MCQs
- Globalisation MCQs
- Indian Economy MCQs
- Retained Earnings MCQs
- Depreciation MCQs
- Partnership MCQs
- Sole Proprietorship MCQs
- Goods and Services Tax (GST) MCQs
- Cooperative Society MCQs
- Capital Market MCQs
- Business Studies MCQs
- Basic Accounting MCQs
- MIS Executive Interview Questions
- Go Language Interview Questions

Top Interview Coding Problems/Challenges!

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions!