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.
Q46. What is null pointer?
NULL pointer is a pointer which is pointing to nothing.
Examples :
int *ptr=(char *)0;
float *ptr=(float *)0;
Q47. How are pointer variables initialized?
Pointer variable are initialized in two ways :
1. Static memory allocation
2. Dynamic memory allocation
Q48. What is copy constructor?
Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.
Q49. What is the difference between #include‹ › and #include " "?
#include‹ › ----> Specifically used for built in header files.
#include " " ----> Specifically used for used for user defined/created n header file.
Q50. What is dynamic array?
The dynamic array is an array data structure which can be resized during runtime which means elements can be added and removed.
Q51. What are macros? What are its advantages and disadvantages?
Macros are abbreviations for lengthy and frequently used statements. When a macro is called the entire code is substituted by a single line though the macro definition is of several lines.
The advantage of macro is that it reduces the time taken for control transfer
as in case of function.
The disadvantage of it is here the entire code is substituted so the program becomes lengthy if a macro is called several times.
Q52. Where is the auto variables stored?
Auto variables can be stored anywhere, so long as recursion works. Practically, they're stored on the stack. It is not necessary that always a stack exist. You could theoretically allocate function invocation records from the heap.
Q53. What is the difference between arrays and linked list?
An array is a repeated pattern of variables in contiguous storage. A linked list is a set of Structures scattered through memory, held together by pointers in each element that point to the next element. With an array, we can (on most architectures) move from one element to the next by adding a fixed constant to the integer value of the pointer. With a linked list, there is a "next" pointer in each structure which says what element comes next.
Q54. What are register variables? What are the advantages of using register variables?
If a variable is declared with a register storage class,it is known as register variable.The register variable is stored in the cpu register instead of main memory.Frequently used variables are declared as register variable as it's access time is faster.
Q55. What is problem with Runtime type identification?
The run time type identification comes at a cost of performance penalty. Compiler maintains the class.
Q56. What is conversion operator?
You can define a member function of a class, called a conversion function, that converts from the type of its class to another specified type.
57. What is a pointer value and address?
A pointer value is a data object that refers to a memory location, bach memory location is numbered in the memory. The number attached to a memory location is called the address of the location.
Q58. What is a static function?
A static function is a function whose scope is limited to the current source file. Scope refers to the visibility of a function or variable. If the function or variable is visible outside of the current source file, it is said to have global, or external, scope. If the function or variable is not visible outside of the current source file, it is said to have local, or static, scope.
Q59. What is storage class? What are the different storage classes in C?
Storage class is an attribute that changes the behavior of a variable. It controls the lifetime scope and linkage. The storage classes in c are auto, register, and extern, static, typedef.
Q60. What the advantages of using Unions?
When the C compiler is allocating memory for unions it will always reserve enough room for the largest member.