Interview Questions

There are the collection of some imperative questions that have been asked during an interview, therefore we've decided to also share these with you. Hope you will like these, if you have any query feel free to contact us. We will be happy to know.


Interview Questions related to c, c++ and oops.

Q16. 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.

Q17. What is the difference between class and structure?

By default, the members or 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.

Q18. What is static identifier?

A file- scope variable that is declared static is visible only to functions within that file. A function -scope or block-scope variable that is declared as static is visible only within that scope.Further more, static variables only have a single instance. In the case of function- or block-scope variables, this means that the variable is not "automatic" and thus retains its value across function invocations.

Q19. What is a dynamic constructor?

The constructor can also be used to allocate memory while creating objects. Allocation of memory to objects at the time of their construction is known as dynamic construction of objects.The memory is allocated with the help of the new operator.

Q20. What is the difference between an Array and a List?

The main difference between an array and a list is how they internally store the data. whereas Array is collection of homogeneous elements. List is collection of heterogeneous elements.

Q21. What are the advantages of inheritance?

Main advantages of using Inheritance are:

1. Code reusability
2. Saves time in program development.

Q22. What is difference between function overloading and operator overloading?

A function is overloaded when same name is given to different function. While overloading a function, the return type of the functions need to be the same.

Q23. Define a class

A class represents description of objects that share same attributes and actions. It defines the characteristics of the objects such as attributes and actions or behaviors. It is the blue print that describes objects.

Q24. What is the term Polymorphism?

To override a method, a subclass of the class that originally declared the method must declare a method with the same name, return type (or a subclass of that return type), and same parameter list.

Q25. What is Overriding?

The main difference between an array and a list is how they internally store the data. whereas Array is collection of homogeneous elements. List is collection of heterogeneous elements.

Q26. What is encapsulation?

Containing and hiding information about an object, such as internal data structures andcode. Encapsulation isolates the internal complexity of an object's operation from the rest of the application.

Q27. What is a pointer variable?

A function is overloaded when same name is given to different function. While overloading a function, the return type of the functions need to be the same.

Q28. What is the difference between a string copy (strcpy) and a memory copy (memcpy)?

The strcpy() function is designed to work exclusively with strings. It copies each byte of the source string to the destination string and stops when the terminating null character () has been moved. On the other hand, the memcpy() function is designed to work with any type of data. Because not all data ends with a null character, you must provide the memcpy() function with the number of bytes you want to copy from the source to the destination.

Q29. What is the difference between a NULL Pointer and a NULL Macro?

Null pointer is a pointer that is pointing nothing while NULL macro will used for replacing 0 in program as #define NULL 0 .

Q30. What is the difference between const char*p and char const* p?

const char*p - p is pointer to the constant character. i.e value in that address location is constant.

const char* const p - p is the constant pointer which points to the constant string, both value and address are constants.