C Language Interview Question and Answers
21. |
What are the differences between structures and union? |
|
A structure variable contains each of the named members, and its size is large enough to hold all the members. Structure elements are of same size.
A Union contains one of the named members at a given time and is large enough to hold the largest member. Union element can be of different sizes. |
|
|
22. |
What is the difference between arrays and pointers? |
|
Array is collection of similar datatype. it is a static memory allocation means we can not increment and decrement the arry size once we allocated. and we can not increment the base address, reassign address.
Pointer is a dynamic memory allocation. we can allocate the size as we want, assigning into another variable and base address incrementation is allowed. |
|
|
23. |
What is dynamic binding? |
|
Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time.It is associated with polymorphism and inheritance. |
|
|
24. |
what is an abstract base class? |
|
An abstract class is a class that is designed to be specifically used as a base class. An abstract class contains at least one pure virtual function. |
|
|
25. |
What is the difference between class and structure? |
|
- By default, the members ot structures are public while that tor class is private.
- structures doesn’t provide something like data hiding which is provided by the classes.
- structures contains only data while class bind both data and member functions.
|
|
|