Answered by: RajiniAnswered On : Feb 19th, 2007
Q. Difference between "C structure" and "C++ structure".
Ans:- C structure cannot have member functions but C++ structure can have. Also in a C structure by default all data members of structure are public and access cannot be changed by specifying the private or protected keywords but in C++ eventhough by default members are public we may change the access using the keywords private and protected.
Q. What is the difference between "overloading" and "overridding"?
ans:- Overloading is a process of having the same function name but different no of arguments or types of arguments within the same class but overriding means redefining a baseclass functions definition in the subclass.
Q. Explain the need for "Virtual Destructor".
Ans:=Virtual destructor ensures destruction of subclass and base class objects in proper order.
Q. What are the different types of polymorphism?
Ans:-Overloading and overriding.
Q. What are the different types of Storage classes?
ans:-Auto,Register,static and extern
Q. What is the difference between "calloc" and "malloc"?
Ans:- calloc and malloc are used for dynamic memory allocation. Calloc initializes the memory locations to zero by default but malloc memory contains garbage values.
Difference between "printf" and "sprintf".
printf will write to the console. sprintf will write to the buffer