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.
Q61. What is the difference between Strings and Arrays?
String is a sequence of characters ending with NULL .it can be treated as a one dimensional array of characters terminated by a NULL character.
Q62. What is a huge pointer?
Huge pointer is 32bit long containing segment address and offset address. Huge pointers are normalized pointers so for any given memory address there is only one possible huge address segment: offset pair. Huge pointer arithmetic is doe with calls to special subroutines so its arithmetic slower than any other pointers.
Q63. In C, why is the void pointer useful? When would you use it?
The void pointer is useful because it is a generic pointer that any pointer can be cast into and back again without loss of information.
Q64. What is generic pointer in C?
In C void* acts as a generic pointer. When other pointer types are assigned to generic pointer, conversions are applied automatically (implicit conversion).
Q65. How pointer variables are initialized?
Pointer variables are initialized by one of the following ways.
1. Static memory allocation.
2. Dynamic memory allocation.
Q66. What are the advantages of auto variables?
The Advantages of auto variables are as follows:
1. The same auto variable name can be used in different blocks.
2. There is no side effect by changing the values in the blocks.
3. The memory is economically used.
4. Auto variables have inherent protection because of local scope.
Q67. What is dynamic memory allocation?
A dynamic memory allocation uses functions such as malloc() or calloc() to get memory dynamically. If these functions are used to get memory dynamically and the values returned by these function are assigned to pointer variables, such a way of allocating memory at run time is known as dynamic memory allocation.
Q68. What is the purpose of realloc?
It increases or decreases the size of dynamically allocated array. The function realloc (ptr,n) uses two arguments. The first argument ptr is a pointer to a block of memory for which the size is to be altered. The second argument specifies the new size. The size may be increased or decreased. If sufficient space is not available to the old region the function may create a new region.
Q69. What is pointer to a pointer?
If a pointer variable points another pointer value. Such a situation is known as a pointer to a pointer.
Example : int *p1, **p2, v=10;P1=&v; p2=&p1;
Here p2 is a pointer to a pointer.
Q70. What is the difference between linker and linkage?
Linker converts an object code into an executable code by linking together the necessary built in functions. The form and place of declaration where the variable is declared in a program determine the linkage of variable.
Q71. What is a function?
A large program is subdivided into a number of smaller programs or subprograms. Each subprogram specifies one or more actions to be performed for the larger program. Such sub programs are called functions.
Q72. What is an argument?
An argument is an entity used to pass data from the calling to a called function.
Q73. What are built in functions?
The functions that are predefined and supplied along with the compiler are known as built in functions. They are also known as library functions.
Q74. Can a Structure contain a Pointer to itself?
Yes such structures are called self-referential structures.
Q75. What is the difference between syntax vs logical error?
Syntax Error
These involves validation of syntax of language.
compiler prints diagnostic message.
Logical Error
Logical error are caused by an incorrect algorithm or by a statement mistyped in such a way that it doesn't violet syntax of language.