TCS Freshers Interview Questions
What is the difference between null and void pointer?
Ans: A Null pointer has the value 0. void pointer is a generic pointer introduced by ANSI. Generic pointer can hold the address of any data type.
what is function overloading
Ans: Function overloading is a feature of C++ that allows us to create multiple functions with the same name, so long as they have different parameters.Consider the following function:
int Add(int nX, int nY)
{
return nX + nY;
}
What is the prime difference between While and Do While Loop ?
Ans: Though while and do-while are loop statements, in Do While it is assured that the statements within the loop will be executed at least once (even if the condition fails.)
In header files whether functions are declared or defined?
Ans: Functions are declared within header file. That is function prototypes exist in a header file,not function bodies. They are defined in library (lib).
What are the different storage classes in C ?
Ans: There are four types of storage classes in C. They are extern, register, auto and static
What is an object?
Ans: Object is a software bundle of variables and related methods. Objects have state and behavior
What is a class?
Ans: Class is a user-defined data type in C++. It can be created to solve a particular kind of problem. After creation the user need not know the specifics of the working of a class.
What does static variable mean?
Ans:Static is an access qualifier. If a variable is declared as static inside a function, the scope is limited to the function,but it will exists for the life time of the program. Values will be persisted between successive
How do you print an address ?
Ans: Use %p in printf to print the address.
What are macros? what are its advantages and disadvantages?
Ans: Macros are processor directive which will be replaced at compile time.The disadvantage with macros is that they just replace the code they are not function calls. similarly the advantage is they can reduce time for replacing the same values.
Difference between pass by reference and pass by value?
Ans: Pass by value just passes the value from caller to calling function so the called function cannot modify the values in caller function. But Pass by reference will pass the address to the caller function instead of value if called function requires to modify any value it can directly modify.
What is the difference between class and structure?
Ans: Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also.
The major difference is that all declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all the members inside the class are private.
What is ponter?
Ans: Pointer is a variable in a program is something with a name, the value of which can vary. The way the compiler and linker handles this is that it assigns a specific block of memory within the computer to hold the value of that variable.
For More Details : Click Here
What is the difference between null and void pointer?
Ans: A Null pointer has the value 0. void pointer is a generic pointer introduced by ANSI. Generic pointer can hold the address of any data type.
what is function overloading
Ans: Function overloading is a feature of C++ that allows us to create multiple functions with the same name, so long as they have different parameters.Consider the following function:
int Add(int nX, int nY)
{
return nX + nY;
}
What is the prime difference between While and Do While Loop ?
Ans: Though while and do-while are loop statements, in Do While it is assured that the statements within the loop will be executed at least once (even if the condition fails.)
In header files whether functions are declared or defined?
Ans: Functions are declared within header file. That is function prototypes exist in a header file,not function bodies. They are defined in library (lib).
What are the different storage classes in C ?
Ans: There are four types of storage classes in C. They are extern, register, auto and static
What is an object?
Ans: Object is a software bundle of variables and related methods. Objects have state and behavior
What is a class?
Ans: Class is a user-defined data type in C++. It can be created to solve a particular kind of problem. After creation the user need not know the specifics of the working of a class.
What does static variable mean?
Ans:Static is an access qualifier. If a variable is declared as static inside a function, the scope is limited to the function,but it will exists for the life time of the program. Values will be persisted between successive
How do you print an address ?
Ans: Use %p in printf to print the address.
What are macros? what are its advantages and disadvantages?
Ans: Macros are processor directive which will be replaced at compile time.The disadvantage with macros is that they just replace the code they are not function calls. similarly the advantage is they can reduce time for replacing the same values.
Difference between pass by reference and pass by value?
Ans: Pass by value just passes the value from caller to calling function so the called function cannot modify the values in caller function. But Pass by reference will pass the address to the caller function instead of value if called function requires to modify any value it can directly modify.
What is the difference between class and structure?
Ans: Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also.
The major difference is that all declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all the members inside the class are private.
What is ponter?
Ans: Pointer is a variable in a program is something with a name, the value of which can vary. The way the compiler and linker handles this is that it assigns a specific block of memory within the computer to hold the value of that variable.
For More Details : Click Here
0 comments:
Post a Comment