Q. What is meant by conditional compilation?

Ans: C pre-processor offers a feature called conditional compilation that is used to switch on or off a particular line or group of lines in a program. Compiler skips over part of a source code by inserting the pre-processing commands #ifdef and #endif, which have the general form as:
#ifdef macro
Stmt1;
Stmt2;
#endif
If macro has been #defined, the block of code will be processed as usual; otherwise not.

Q. Give the difference between #include <stdio.h> and #include “stdio.h”.

Ans:#include “filename”: The search for the file is made first in the current directory and then in the standard directories as mentioned in the include search path. #include <filename>: This command would look for the file in the standard list of directories. Both of these directives cause the entire contents of filename to be inserted into the source code at that point in the program.

Q. Define the following:
(i) Auto variables. (ii) Static variables.
(iii) External variables. (iv) Register variables.


Ans:(i)Auto variables: The features are as follows
Declaration place:-declared inside a function in which they are to be utilized, that’s why referred as local or internal variables.
Declaration syntax:- A variable declared inside a function without storage class specification by default is an automatic variable. However, we may use the keyword auto to declare it explicitly.
main()
{
auto int age;
}
Default initial value:-Garbage value
Scope:-created when the function is called and destroyed on exit from the function.
Life:- till the control remains within the block in which defined.

(ii) Static variables: The features are as follows Declaration place:-may be declared internally or externally.
Declaration syntax:-we use the keyword static to declare a static variable.
Static int age;
Default initial value:- Zero
Scope:-in case of internal static variable, the scope is local to the function in which defined while scope of external static variable is to all the functions defined in the program.
Life:- value of variable persists between different function calls.

(iii) External variables: The features of variables are as follows
Storage: Memory
Default initial value: Zero
Scope: global
Life: As long as program execution does not come to an end

(iv)Register variables: The features of variables are as follows
Storage: CPU registers
Default initial value: Garbage value
Scope: Local to the block in which defined
Life: till the control remains within the block in which defined

Q.  What is the difference between Testing & Debugging? Explain different Debugging Techniques.

Ans:Program testing is the process of checking program, to verify that it satisfies its requirements and to detect errors. These errors can be of any type-Syntax errors, Run-time errors, Logical errors and Latent errors. Testing include necessary steps to detect all possible errors in the program. This can be done either at a module level known as unit testing or at program level known as integration testing.

Debugging is a methodical process of finding and reducing the number of bugs in a computer  program making it behave as expected. One simple way to find the location of the error is to use print statement to display the values of the variables. Once the location of the error is found, the error is corrected and debugging statement may be removed.

Different debugging techniques are:
• To place print statements throughout the program to display the values of variables.
• Conditional compilation can be used to switch on or off debugging statements.
• Elimination and refinement: location of error is arrived by listing the possible causes of the error.
• Backtrack: The incorrect result is backtracked through the program logic until error is located.

Q.  What are the different types of key switches used in keyboards? Explain their working with the help of neat diagram.

Ans:Membrane Contact Keyswitches: The membrane contact keyswitch is a variant of the rubber dome design and works in a rather similar way. The basic mechanism is the same: contact pairs on a circuit board, and rubberized boots or "dimples" with a carbon button underneath. Press down the key and the rubber deforms, the carbon touches the contacts and a keystroke is sensed. The big difference here is that individual keycaps and plastic plungers are replaced with a thin membrane that fits over the rubber domes. There may not even be separate rubber domes, just molded "dimples" for each key, the carbon buttons in each dimple. The user presses directly on the membrane to collapse the domes and create contact with the printed circuit board. Travel is very small with this design, since there is no keycap and no plunger.

Capacitive Keyswitches: All of the other keyswitch technologies described in this section are contact designs. They all work using different ways of causing physical contact to establish a circuit and register a keypress. There is one keyboard technology, however, that detects keystrokes without using any form of contact at all. The capacitive keyswitch design makes use of a design characteristic of capacitors to determine when a key has been pressed. A capacitor is an electronic component that is comprised (at least conceptually) of a pair of parallel metal plates. When an electric field is applied to the plates, a charge is stored there.

Foam and Foil Contact Kevswitches: Like the mechanical contact keyswitch, the foam and foil contact keyswitch design also uses contact to complete a circuit and indicate when a keypress is made. However, it takes a very different approach to creating the contact. Each keyswitch is constructed of a (usually plastic) plunger on the top, connected to a foam pad. The foam pad is coated with foil on the bottom. A spring wraps around the plunger at the top, suspending the key in its normal position. Below all the keyswitches is a circuit board, printed with many pairs of copper contacts; one pair is oriented under the foam pad of each keyswitch. When they key is pressed, the foam pad moves down and touches the pair of copper contacts, completing the circuit and telling the keyboard that a key was pressed. When the key is released, the spring pulls the plunger back up, breaking the contact.

Mechanical Contact Kevswitches: The simplest keyswitch technology in conceptual terms, mechanical contact keyswitches are "classical" switches, working in much the same way that many other types of switches do in the world around us. They work simply on the basis of two contacts mechanically touching each other to complete a circuit, not unlike a doorbell in some ways.

Q.  Define the following terms with reference to a magnetic disk.

i) Access time. ii) Seek Time.
iii) Latency Time. iv) Transfer rate.


Ans:i) Access Time: Access time is the interval between the instant a computer makes a request for transfer of data from a disk system to the primary storage and the instant this operation is completed. Access time depends on seek time, latency time and transfer rate.

ii) Seek Time: The time required to position the read/write head over the desired track is called the seek time. It depends upon the position of the access arms assembly when the read/write command is received.

iii) Latency Time: The time required to spin the desired sector under the read/write head is called the latency time. It is also known as the rotational delay time and depends on the distance of the desired sector from the initial position of the head on the specified track. It also depends on the rotational speed of the disk.
iv) Transfer Rate: Transfer rate is the rate at which data are read from or written to the disk.

Transfer rate depends on the density of the stored data and rotational speed of the disk.  

Q.  What is an MICR device? Where is it primarily used?  

Ans:MICR refers to Magnetic Ink Character Recognition, and is a special type of printing used at the bottom of cheques, to be read by computers. It contains the cheque number, bank routing code, and account number.