Interview Related Key Points


Procedural Language:
In these language program is a predefined instructions. Computer execute these instruction in which they are written. FORTRAN, Basic Pascal are the example of it

Non-Procedural Language:
In Non-Procedural Language user only need to tell the computer “what to do” rather than “How to do”. Like SQL and RPG are the example of it.

OOP (Object Oriented Programming):
OOP is a technique, in which we write a program on the basis of object. An object is the collection of Data and function. Which may be represent the Person, Thing or Place in the real world.

Structure Programming:
Structure Programming is a technique in which we divide our program into small units call module.

Function:
A function is a named of block of code that perform some action. The statement in function will execute when the function is call.

Function Definition:
A set of statement that explain what a function does is called function definition.

Passing Parameter to Function:
Parameter are the value that are pass to function when it call. Parameter are given in parentheses.
The parameters in function call are called Actual Parameters.
The parameters in function declaration are called formal parameters.
There are two ways to passing parameter to function:
§  Pass By Value
§  Pass By Reference

Pass By Value:
A Parameters passing mechanism in which the value of actual parameter is copied to formal parameters. If the function makes changing in formal parameters it doesn’t affect the actual parameters.

Void show (int); __________________ Function Declaration
Void main()
{
int n = 1;
show(n) ____________________ Actual Parameter  is n
}

Void show(int num) ______formal Parameter is num also this is function is call function definition.
{
Printf(“%d”,num);
}




Pass By Reference:
A Parameter passing mechanism in which the address of actual parameter is passed to the called function is pass by reference. The formal parameter is not created separately in the memory. Formal parameter is the second name of actual parameter. Its mean that single memory shared between the actual parameters and formal parameters. If the called function makes changes in formal parameters, it also available in the calling function.

Void show (int&); __________________ Function Declaration
Void main()
{
int n = 1;
show(n) ____________________ Actual Parameter  is n
}

Void show(int &num) ______formal Parameter is num also this is function is call function definition.
{
Printf(“%d”,num);
}

Static Variable, Local Variable, Global Variable:
A variable declared inside a function is known as Local variable.
A variable declared outside the function is known as Global Variable.
A local variable declared with the word static is called Static Variable. The key word static is used to increase the life time of the variable.

Scope of the Static Variable, Local Variable, Global Variable:
The scope of the static variable is similar to the local variable static variable also declared inside the function.
Local variable can only be accessed in the function where it declared.
Global variable can be accessed by all function. It mean these variable are globally.

Life of the Static Variable, Local Variable, Global Variable:
The life of the local variable as much as the function is not terminated. They are created when the function is executed and destroy when control exit from the function.
The global variable as long as exist in the memory as much as time program is running.
The life of the static variable is similar to the global variable but they can only be used within function. These variable are when the function is execute but they can never be used outside the function.

Default Parameters:
The parameters initialized during the declaration are called Default Parameters. The default parameters allow the user to call a function without giving required parameters. The can also specify the value in the parameters but if the user specify the value then default parameters will no b used.
Void show(int a = 100);
Void main()
{



Show();____________ this function calling will used the default parameters.
Show(3); ____________ this function calling will not use the default parameters. Because the value is assigned.
}


Void show(int t)
{
Printf(“%d”,t);
}

Function Overloading:
The process of declaring the multiple functions with same name but different in parameters is called function overloading. The function overloading with the same name must differ in one of following ways.
  •  Types of Parameters
  •   Number of Parameters
  •   Sequence of Parameters

Example:
  •  Float avg(int,int);
  •   Float avg(float,float);
  •   Float avg(int,float); 

Static Functions:
Static functions are functions that are only visible to functions in the same file and they are not callable from outside. Static functions are used when we only need to call them within the single source file they are defined in.



Comments

Popular posts from this blog

Difference b/t Asp and Asp.net

C# Interview Answers