Q/A, Programming & Coding Tutorials

...Search for Answers and Tutorials, Search Easy Learn Easy...

Why Gray Codes are used in K-MAP instead of Binary Code?

Gray code belongs to a class of codes called minimum change code in which the only one-bit code group changes when going from one step to the next. This is an un-weighted code which means that there are no specific weights assigned to the bit positions.

Advantages of Gray Code

In Gray Code, if we go from one decimal number to next, only one bit of the Gray code changes. Because of this feature, an amount of switching is minimized and the reliability of the switching systems is improved.

Gray Codes are used in K-MAP instead of Binary Code
Gray codes actually follow Adjacency property i.e between two successive gray codes there is only one-bit change and in the binary code, there will be multiple value changes.

Because of Adjancey property when one plots a K-MAP, literals can be grouped keeping other literal constant.

For example: 00, 01, 11, 11
Like 01, 11

Example of Binary to Gray code conversion.

Convert 1011 Binary to Gray

1011 the binary value, there are two values MSB as well as LSB
[MSB] [1 from left] - 1011 - [LSB] [1 from right]

Rules to convert Binary to Gray code

  • Write MSB as it is. 
  • Add MSB in a next and neglect carry if occurs.

Convert 1011 (Binary) to (Gray)

  • MSB is 1 and writes it as it is as 1. 
  • Now add MSB [1] next to next value [0] and add both of them, if a carry occurs discard it. 
  • Now follow same way for all the numbers 0, 1 & 1.

IC Digital Logic Families

Integrated Circuits

Digital circuits are invariably constructed with integrated circuits. An integrated circuit is a small silicon semiconductor crystal, called a chip containing electrical components such as transistors, diodes, resistors, and capacitors.

The various components are interconnected inside the chip to form an electronic circuit. The chip is mounted on a metal or plastic package, and connections are welded to external pins to form the IC.

IC Digital Logic Families

Why Integrated Circuits are used? 

Integrated circuits are very small electronic circuits which were built to perform a particular function made of active and passive components such as transistors, diodes, resistors, capacitors etc... And these are sometimes called a chip or microchip, is a semiconductor wafer on which thousands or millions of tiny resistors or capacitors or transistors will be fabricated.

IC Digital Logic Families will have either NAND or NOR gate is a logic gate. Because NAND and NOR gates are universal gates and these will help IC to perform efficiently as well as it will make them a smaller size.

With the help of NAND and NOR representation, these ICs will cost little lower than other gates representation because any gates can be represented by NAND and NOR gate.

TTL - Transistor Transistor Logic

TTL has an extensive list of digital functions and is currently the most popular logic family. Which has been built from bipolar junction transistors (BJTs) and resistors.

The term transistor-transistor is because both logic function and amplification is done by the transistor. Using TTL logic families, many logic gates can be fabricated in a single integrated circuit. For logic gate built using TTL logic families, input are given to the emitters of the input transistor.

ECL - Emitter Coupled Logic

ECL is used in systems requiring high-speed operations. This logic family will be integrated for high-speed operations and integrated circuit will be bipolar transistor logic family. ECL uses an overdriven BJT (bipolar junction transistors) differential amplifier with single ended input and limited emitter current to avoid the saturated region of operation and it's slow to turn off behavior. 

MOS - Metal-oxide semiconductor

The metal–oxide–semiconductor field-effect transistor (MOSFET, MOS-FET, or MOS FET) is a type of field-effect transistor (FET). It has an insulated gate, whose voltage determines the conductivity of the device.

CMOS - Complementary Metal-oxide Semiconductor

CMOS is used in systems requiring low power consumption. Mostly CMOS technology is used in microprocessors, microcontrollers, or even on static RAM and other digital logic circuits as well as devices. 
CMOS technology is also used for several analog circuits such as image sensors (CMOS sensor), data converters, and highly integrated transceivers for many types of communication.

I2L - Integrated-Injection Logic

Integrated injection logic is a class of digital circuits built with multiple collector bipolar junction transistors (BJT). It can also be used in devices like which consume lower power. Most effectively it can be used in VLSI chips. 
Although the logic voltage levels are very close (High: 0.7V, Low: 0.2V), I2L has high noise immunity because it operates by current instead of voltage. It is sometimes also known as merged transistor logic.

Binary Logic & Logical Gates and Representation

Binary Logic

Binary logic deals with variables that take on two discrete values and which operations that assume logical meaning. The two values the variables take may be called by different names (e.g true and false, yes and no). But for our purpose, it is convenient to think in terms of bits and assign the values of 1 and 0.

Binary logic is used to describe, in a mathematical way, the manipulation, and processing of binary information. It is particularly suited for the analysis and design of digital systems.

Actually binary logic consists of binary variables and logical operations. The variables are designated by letters of the alphabet such as A, B, C, x, y, z, etc...with each variable having two and only two distinct possible values; 1 as true and 0 as a false (0 and 1). And there are few logical operations that can be called as a AND, OR and NOT.

While explaining these logical operations

AND: is known as a multiplication and represented by . sign in digital logic and in a formal expression it can be written as an A.B = AB or 1.1 = 1 or we can say that x.y = z.

OR: is known as an addition and it can be represented by the + in digital logic the formal expression can write as an A+B = C or 1+1 = 1.

NOT: this operation is the inverse of all where we can represent this by writing following x' = z or 1 = 0. We will be complementing the value of the input.

Registers and Register Transfer


A register is a group of binary cells. Since cell stores one bit of information. It follows that a register with n cell can store any discrete quantity of information that contains n bits. The state of a register is an n-tuple number of 1's and 0's, with each bit designating the state of one cell in the register.
The content of a register is a function of the interpretation given to the information stored in it. Consider, for example following 16 cell register.

1 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1

Physically one may think of the register is composed of 16 binary cells, with each cell storing either a 1 or a 0. Suppose that the bit configuration stored in the register is as shown. The state of the register is the 16 tuple number.

Register with n cell can be in one of 2n possible states. Now if one assumes that the content of the register represents a binary integer, then obviously the register can store any binary number from 0 to 216 - 1.

Register Transfer

A digital computer is characterized by its registers. The memory unit is known as a collection of thousands of registers for storing digital information. The processor unit is composed of various registers that store operands upon which operations are performed.

The control unit uses registers to keep track of various computer sequences, and every input or output device must have at least one register to store the information transferred to or from the device.

Alphanumeric Codes & Binary Storage and Registers

Alphanumeric Codes

Digital computers' applications require handling of the data that requires not only of numbers but also of letters. For example, an insurance company with millions of policy holders may use a digital computer to process its files.

To processes holder's name in the binary form, it requires having a binary code for the alphabet. In addition, the same binary code must represent decimal number and some other special characters.

An alphanumeric code is a binary code of a group of elements consisting of the ten digits. The 26 letters of the alphabet. And a certain number of special symbols such as $.

The total number of elements in an alphanumeric group is greater than 36. Therefore, it must be coded with a minimum of six bits 26 = 64 but  25 = 32 is insufficient.

Binary Storage and Registers

binary storage and registers
The discrete elements of information in a digital computer must have a physical existence in some information storage medium. Furthermore, when discrete elements of information are represented in binary form, the information storage medium most contain binary storage elements for storing individuals bits.

A binary cell is a device that possesses two stable states and is capable of storing one bit of information.

The input to the cell receives excitation signals that set it to one of the two states. The output of the cell is a physical quantity that distinguishes between the two states. The information stored in a cell is a 1 when it is in one stable state and a 0 when in the other stable state.

Example of the binary cell are electronic flip-flop circuits, ferrite cores used in memories, and positions punched with a hole or not punched in a card. 

Universal Logic Gates - NOR Gate and NAND Gate

Simply in digital logic, a universal logic gate is a logic gate that can be used to construct all other logic gates like AND, OR & NOT. These basic gates can be represented or created with the help of universal digital logic gates.

NOR gate - Universal Logical Gate

It is the combination of NOT and OR gate in such a way that output of OR gate is connected to the input of the NOT gate. 

To talk about its input and output this will take one or multiple inputs but the output of the gate is high only when the input is low. Hence its outputs are the reverse of OR gate. 

NOR gate - Universal Logical Gate

Truth Table

Input               Output
A      B            Y=(A.B)'
0       0             1 
0       1             0 
1       0             0 
1       1             0

Boolean Equation  
Y = (A.B)'

NAND Universal Logic Gate

It is the combination of NOT and AND gate in such a way that output of NAND gate is connected to the input of the NOT gate. 

The output of this gate is low only when all inputs are high. Hence this gate is a reverse of AND gate. 

Truth Table

Input               Output
A      B            Y=(A.B)'
0       0             1 
0       1             1 
1       0             1 
1       1             0

Boolean Equation

Y = (A.B)'

Digital Logic : Basic AND gate OR gate and NOT gate.

A digital circuit having one or more input signals but only one output is called a logic gate or simply a gate. Logic gates are the basic building blocks of any digital systems.

The table which shows different combination of input along with their possible outputs is called truth table. Moreover, truth table will help us to find out the exact output of the inputs for different gates i.e AND gate OR gate and NOT gate.

Basic AND Gate

The AND gate has two or more inputs and a single output. The AND gate provides a high output only when all inputs are high. AND gate performs logical multiplication as a function. 

Basic AND Gate

Truth Table

Input                Output
A     B             Y=A.B
0      0               0
0      1               0
1      0               0
1      1               1

Boolean Equation


Basic OR gate

The OR gate will have two or more inputs and a single output. The OR gate provides a high output if any or all inputs are high. The AND gate performs logical addition, more commonly known as OR function.

Basic OR gate

Truth Table

Input                Output
A     B             Y=A.B
0      0               0
0      1               1
1      0               1
1      1               1

Boolean Equation
Y= A+B

Basic NOT gate

The not gate will have only one input and one output. The NOT gate provides high output if an input is low. It provides the low output if an input is high. The NOT gate performs a basic logical function called inversion or complementation.

Most commonly NOT is also called as an inverter because output state is always opposite to input state. 

Basic NOT gate

Truth Table

Input      Output
A            Y=A'
0              1
1              0

Boolean Equation
Y = A'

What is Gray Code? and Gray Code's Advantages

This code belongs to a class of codes called minimum change code in which only one bit in the code group changes when going from one step to the next. This is an un-weighted code which means that there are no specific weights assigned to the bit positions.

Because of this the Gray code is not suited for arithmetic operations but finds applications is input/output devices and some types of analog to digital converters (ADCs)

Advantages of Gray Code

In Gray code, if we go from one decimal number to next, only one bit of the gray code changes. Because of this feature, an amount of switching is minimized and the reliability of the switching systems is improved. 

What is Digital Operation?

The operations performed in digital electronics are called digital operations. Some common digital operations are counting, arithmetic operations and logic operations.

The counting operation is performed by "Counters". The arithmetic operation is performed by Arithmetic and logic unit and are addition, subtraction, multiplication, and division and are accomplished with other digital circuits. The logic operations too are performed by ALU and they include inversion (NOT), AND and OR gates.

Selecting a single output of multiple inputs (Multiplexing) or giving out many outputs with single inputs (Demultiplexing) are can also be treated as digital operation. Similarly, the process of encoding and decoding are also digital operations. These operations are performed by different data processing circuits like Multiplexes, de-multiplexes, encoder, decoder etc... 

Definition for Digital Signals

Digital signals are discrete time signals generated by digital modulation. It is a signal where amplitude can have only given discrete values between defined limit. Simply, it is a signal that change amplitude is discrete steps.

Digital signals are obtained when discrete time signals are quantized and then coded. Generally, digital signals are less subjected to deterioration during transmission.

Digital signals are denoted by the square wave. The output of the digital computer is an example of the digital signal. The waveform of a digital signal is known as a digital waveform.

What is Blogging? How to Create a Blog?

Blogging means the art of writing and sharing new thoughts or opinion about the particular topic via web journal. 

A Blog is also called as a weblog or web log which means website consisting of pages or posts where a person can share his/her thoughts about the topics. 

Nowadays's blogging has become so popular because this has influenced every online business as well as companies information sharing pattern. 

In this article, you are going to learn, 

How to create a blog?

I'm using Blogger platform for this blogging series tutorial. This is one of the easiest platforms for creating a blog. 

Step 1: You have to have a Gmail account to create a blog on blogger. 
Step 2: Now you have to go to Blogger.com to create your own blog. 
Step 3: Just fill necessary information on blogger form to create a blog. 

Step 4: Now click on create a blog! button and you are good to go with your blogging journey. 

Blog creation is that simple, you can just log in your Gmail account and choose google's blogger platform and start your own online journal or diary. 

What is Digital Logic?

Digital logic is the representation of signals and sequences of the digital circuit through numbers.

It is the basis for digital computing and provides a fundamental understanding of how circuits and hardware communicate with a computer.

Digital logic is typically embedded into most electronic devices including a computer, video games, calculators etc.

Digital logic involves the study of digital electronics in a logical way. It is of two positive logics and negative logic.

What is Digital Signal?

Digital signals are discrete time signals generated by digital modulation. It is a signal where amplitude can have only given values between defined limit.

Simply, it is a signal that changes amplitude is discrete steps.

Digital Signals are obtained where discrete time signals are quantized and then coded.

Generally, digital signals are less subjected to deterioration during transmission.

Digital signals are denoted by a square wave. The output of the digital computer is an example of the digital signal. 

Create Simple Navigation Using HTML and CSS

Create Simple Navigation Using HTML and CSS

Create Simple Navigation Using HTML and CSS



 <meta charset='utf-8'/>
 <link rel="stylesheet" type="text/css" href="menu.css">
 <div id='top_nav'>
   <li><a href="#">Home</a></li>
   <li><a href="#">C</a>
     <li><a href="#">Web Development</a></li>
     <li><a href="#">C Programming</a></li>
     <li><a href="#">Java Tutorials</a></li>

   <li><a href="#">Java</a>
     <li><a href="#">Web Development</a></li>
     <li><a href="#">C Programming</a></li>
     <li><a href="#">Java Tutorials</a></li>

   <li><a href="#">PHP</a>
     <li><a href="#">Web Development</a></li>
     <li><a href="#">C Programming</a></li>
     <li><a href="#">Java Tutorials</a></li>
   <li><a href="#">About</a></li>
   <li><a href="#">Contact</a></li>
   <li><a href="#">Privay</a></li>
   <li><a href="#">Terms</a></li>




Create New Text File and Copy this code and save it as menu.css and keep both the HTML file and css file in same folder.  

#top_nav li:hover ul{
 display: block;

 display: block;
 position: relative;
 background: #067;
 border: 1px solid rgb(200,140,0);
 font: bold 14px ubuntu;
 width: 1000px;
 height: 40px;
 margin: 0px auto;

#top_nav ul{
 margin: 0px;
 padding: 0px;

#top_nav li{
 position: relative;
 float: left;
 list-style-type: none;

#top_nav ul:after{
 content: *.*;
 display: block;
 height: 0px;
 clear: both;
 visibility: hidden;

#top_nav ul ul{
 position: absolute;
 display: none;
 left: 0px;
 width: 0px;

#top_nav li a{
 text-decoration: none;
 display: block;
 color: #fff;
 padding: 10px;

#top_nav ul ul li{ 
background: #fff;

#top_nav ul ul li a{ 
 color: #000;
 width: 100%; 

What Malicious Code?

Malicious code refers to a broad category of software threats to our network and systems. Perhaps the most sophisticated types of threats to computer systems are presented by malicious codes that exploit vulnerabilities in computer systems. Any code which modifies or destroys data, steals data , allows unauthorized access, exploits or damage a system, and does something that user did not intend to do, is called malicious code. There are various types of malicious code we will encounter, including Viruses, Trojan horses, Logic bombs, and Worms.

A computer program is a sequence of symbols that are caused to achieve a desired functionality; the program is termed malicious when their sequences of instructions are used to intentionally cause adverse affects to the system. In the other words we can’t call any “bug” as a Malicious Code. Malicious codes are also called programmed threats. The following figure provides an overall taxonomy of Malicious Code.

What is Intruders? explain it's classes.


One of the two most publicized threats to security is the intruder (the other is viruses), generally referred to as a hacker or cracker. There are three classes of intruders found:

Masquerader: An individual who is not authorized to use the computer and who penetrates a system's access controls to exploit a legitimate user's account. The masquerader is likely to be an outsider.
Misfeasor: A legitimate user who accesses data, programs, or resources for which such access is not authorized, or who is authorized for such access but misuses his or her privileges. The misfeasor generally is an insider.
Clandestine user: An individual who seizes supervisory control of the system and uses this control to evade auditing and access controls or to suppress audit collection. The clandestine user can be either an outsider or an insider.
Intruder attacks range from the benign to the serious. At the benign end of the scale, there are many people who simply wish to explore internets and see what is out there. At the serious end are individuals who are attempting to read privileged data, perform unauthorized modifications to data, or disrupt the system.

Define the Concept of Trusted System?

A trusted system is a system that is relied upon to a specified extent to enforce a specified security policy. As such, a trusted system is one whose failure may break a specified security policy.

Trusted systems in the context of national or homeland security, law enforcement, or social control policy are systems in which some conditional prediction about the behavior of people or objects within the system has been determined prior to authorize access to system resources.

For example, trusted systems include the use of "security envelopes" in national security and counterterrorism applications, "trusted computing" initiatives in technical systems security, and the use of credit or identity scoring systems in financial and anti-fraud applications; in general, they include any system (i) in which probabilistic threat or risk analysisis used to assess "trust" for decision-making before authorizing access or for allocating resources against likely threats (including their use in the design of systems constraints to control behavior within the system), or (ii) in which deviation analysis or systems surveillance is used to ensure that behavior within systems complies with expected or authorized parameters.

How Does Block Cipher Differs from Stream Cipher?

Stream Cipher

  • A stream cipher is an encryption algorithm that encrypts 1 bit or byte of plaintext at a time. It uses an infinite stream of pseudorandom bits as the key.
  • Examples of Stream Cipher
    One-time pad.
    Block Cipher in OFB OR CRT MODE. 
  • A stream cipher is synchronous if its key sequence does not depend on the plain- and ciphertexts but only on the previous elements of the key sequence and the initial key.

Block Cipher

  • Partition the text into relatively large (e.g. 128 bits) blocks and encode each block separately. The encoding of each block generally depends on at most one of the previous blocks.
    the same “key” is used at each block.
  • A block cipher is a method of encrypting text (to produce ciphertext) in which a cryptographic key and algorithm are applied to a block of data (for example, 64 contiguous bits) at once as a group rather than to one bit at a time. The main alternative method, used much less frequently, is called the stream cipher.

What is Originator Controlled Access Control (ORCON)?

An originator controlled access control (ORCON or ORGCON) bases access on the creator of an object (or the information it contains). Information is controlled by originator or creator of information not owner. Sometimes creator may be owner too. The goal of this control is to allow the originator of the file (or of the information it contains) to control the dissemination of the information. ORCON is the combination of MAC and DAC and the basic rules are:
  • The owner of an object cannot change the access controls of the object. 
  • When an object is copied, the access control restrictions of that source are copied and bound to the target of the copy. 
  • The creator (originator) can alter the access control restrictions on a per-subject and per-object basis.

What is The Biba Integrity Model?

Integrity refers to the trustworthiness of data or resources. Integrity is usually defined in terms of preventing improper or authorized change to data. There are three main goals of integrity:

- Preventing unauthorized users from making modifications to data or programs.
- Preventing authorized users from making improper or unauthorized modifications.
- Maintaining internal and external consistency of data and programs.

The Biba integrity model was published in 1977 at the Mitre Corporation; one year after the Bell La-Padula model was published. 

The primary motivation for creating this model is the inability of the Bell-LaPadula model to deal with integrity of data. 

The Biba model addresses the problem with the star property of the Bell-LaPadula model, which does not restrict a subject from writing to a more trusted object.

Featured Tutorials


View more


View more

C Programming

View more


View more


View more


View more

Digital Logic

View more


View more