Totel:235 Click:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
C++ Interview Questions And Answers
Page 1
Questions 1 Question :
what is the difference between parameter and argument?
Answer
Diff b/w parameter and argument is :
Argument bassically is one of the following -
> An Expression in the comma-separated list in a function call.
> A sequence of one or more preprocessor tokens in the comma-separated list in a macro call.
> Its represent the value which you pass to a procedure parameter when you call the procedure. The calling code supplies the arguments when it calls the procedure.
> It is something passed into a function(value), whereas a parameter is the type of data plus the name.
Parameter bassically is one of the following -
> An object that is declared in a function declaration or definition.
> An identifier b/w the parentheses immediately following the macro name in a macro definition.
> It is represent a value that the procedure expects you to pass when you call it. The procedure's declaration defines its parameters.
This example explains the difference b/w a parameter and an argument:
void function(int x, char * rs); //x and rs are parameters
template <class Tem> class M {}; //Tem is a parameter
int main()
{
char c;
char *p = &c;
func(5, p); //5 and p are arguments
M<long> a; //'long' is an argument
M<char> another_a; //'char' is an argument
return 0;
}
Questions 2
What is the difference between class and structure?
Answer
Diff b/w Class and Structure is :
Class is difined as-
>Class is a successor of Structure. By default all the members inside the class are private.
>Class is the advanced and the secured form of structure.
>Classes are refernce typed.
>Class can be inherited.
>In Class we can initilase the variable during the declaration.
>Class can not be declared without a tag at the first time.
>Class support polymorphism.
Structure difine as :
> In C++ extended the structure to contain functions also. All declarations inside a structure are by default public.
> Structures contains only data while class bind both data and member functions.
> Structure dosen't support the polymorphism, inheritance and initilization.
> Structure is a collection of the different data type.
> Structure is ovrloaded.
> Structures are value type.
> Structure can be declared without a tag at the first time
Questions 3 What is the difference between an object and a class?
Answer
Class and Objects are diff but related concepts. Every objects belogs to the class and evry class have a one or more related objets.
Class are:
> A Class is static.
> A class combination of data(called data members)and functions(called member functions).
> Class is a userdefined datatype with data members and member functions.
> Classe defines object.
> One class can define any no of Object.
> Class is a template(type) or blue print its state how objects should be and behave.
Object are:
> Object is an instance of a class while a class can have many objects.
> Object is a dynamic.
> Objects are the basic runtime entities in an object oriented sysyem.
> Data and function which combine into a single entity is called object.
> Objects are instances of classes which identifies the class propeties.
> Object can't define classes.
> Object can created and destroyed as your necessity.
> Object is defined as a s/w construct which binds data and logic or methods(functions) both.
Questions 4 Difference between realloc() and free()?
Answer
Diff b/w realloc() and free():
realloc():
> It is used to free the memory in the program.
> This function is used to resize memory.
> realloc() means it giving string variables into the existed memory
free():
> Basically It is a macro. Macro used to deallocate memory.
> free() function is used free the memory which is allocated by malloc(),calloc() functions.
> free() means it empties the array.
Questions 5 What is a template?
Answer
Templates is defined as :
> It is a framework for web pages and sites.
> Its type of model or standard for making comparisons.
> It is a feature of the C++ programming language its allow functions and classes to be operate with generic types.
> It is a tool for enforcing a standard layout and look and feel across multiple pages or within content regions.
> Its a model or pattern used for making multiple copies of a single object.
Goto Page:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
CPP Objective Questions And Answers
CPP Objective Questions And Answers
CPP Interview Questions And Answers
CPP Interview Questions And Answers
R4R,CPP Objective, CPP Subjective, CPP Interview Questions And Answers,CPP,CPP Interview,CPP Questions ,CPP Answers