All Differences Between Java and C++
PointersJava does not have an explicit pointer type. Instead of pointers, all references to objects—including variable assignments, arguments passed into methods, and array elements—areaccomplished by using implicit references. References and pointers are essentially the same thingexcept that you can’t do pointer arithmetic on references (nor do you need to).Reference semantics also enable structures...
Showing posts with label C Programming. Show all posts
Showing posts with label C Programming. Show all posts
October 15, 2013
October 09, 2013

Question- What is a register variable?Answer- Register variables are stored in the CPU registers. Its default value is a garbage value. Scope of a register variable is local to the block in which it is defined. Lifetime is till control remains within the block in which the register variable is defined. Variable stored in a CPU register can always be accessed faster than...
April 29, 2013

In C++, what is the difference between method overloading and method overriding?
Ans- Overloading
a method (or function) in C++ is the ability for functions of the
same name to be defined as long as these methods have different
signatures (different set of parameters). Method overriding is the
ability of the inherited class rewriting the virtual...

What is the difference between a pointer and a reference?
Ans- A reference must always refer to some object and, therefore, must
always be initialized; pointers do not have such restrictions. A pointer
can be reassigned to point to different objects while a reference
always refers to an object with which it was initialized.
How are prefix and postfix versions of...

Can you think of a situation where your program would
crash without reaching the breakpoint which you set at the beginning of
main()?
Ans- C++ allows for dynamic initialization of global variables before main() is
invoked. It is possible that initialization of global will invoke some function.
If this function crashes the crash will occur before main() is entered.
Name...

What is multiple inheritance(virtual inheritance)? What are its advantages and disadvantages?
Ans- Multiple Inheritance is the process whereby a child can be derived
from more than one parent class. The advantage of multiple inheritance
is that it allows a class to inherit the functionality of more than one
base class thus allowing for modeling of complex relationships....

What is a container class? What are the types of container classes?
Ans- A container class is a class that is used to hold objects in memory or
external storage. A container class acts as a generic holder. A container class
has a predefined behavior and a well-known interface. A container class is a
supporting class whose purpose is to hide the topology used for maintaining...

What is Memory alignment??
Ans- The term alignment primarily means the tendency of an address pointer value
to be a multiple of some power of two. So a pointer with two byte alignment has
a zero in the least significant bit. And a pointer with four byte alignment has
a zero in both the two least significant bits. And so on. More alignment means a
longer sequence of zero...

What is default constructor?
Ans- Constructor with no arguments or all the arguments has default values.
What is copy constructor?
Ans- Constructor which initializes the it's object member variables ( by
shallow copying) with another object of the same class. If you don't
implement one in your class then compiler implements one for you.
for example:
Boo Obj1(10);...

What is encapsulation??
Ans- Containing and hiding information about an object, such as internal data
structures and code. Encapsulation isolates the internal complexity of an
object's operation from the rest of the application. For example, a client
component asking for net revenue from a business object need not know the data's
origin.
What is inheritance?
Ans-...