C Interview Questions
C Interview Questions
C Interview Questions
1 : extern int x;
A. 1 B. 2 C. 1 and 3 D. 3
D. y = (int)((int)x + 0.5)
4. What would be the equivalent pointer expression for referring the array element
a[i][j][k][l]
A. remove(var-name); B. free(var-name);
C. delete(var-name); D. dalloc(var-name);
8. Which bitwise operator is suitable for turning off a particular bit in a number?
.#include<stdio.h>
#include<stdlib.h>
#define MAXROW 3
#define MAXCOL 4
int main()
{ int **p, i, j;
10. What function should be used to free the memory allocated by calloc() ?
A. flushes all streams and specified streams. B. flushes only specified stream.
#include<stdio.h>
int main()
int x;
for(x=-1; x<=10; x++)
if(x < 5)
continue;
else
break;
printf("TechnoVeta");
return 0;
14.How many times the while loop will get executed if a short int is 2 byte wide?
#include<stdio.h>
int main()
int j=1;
j++;
}
return 0;
/* Some code */
2. int f(a, b)
int a; float b;
/* Some code */
17. What will happen if in a C program you assign a value to an array element whose
subscript exceeds the size of array?
#include<stdio.h>
int main()
FILE *fp;
fp=fopen("trial", "r");
return 0;
B. A structure which contains a char pointer which points to the first character of a file.
20. To print out a and b given below, which of the following printf() statement will you
use?
#include<stdio.h>
float a=3.14;
double b=3.14;
#include<stdio.h>
int main()
arrfptr x;
return 0;
}
A. x is a pointer B. x is an array of three pointers
const charp p;
#include<stdio.h>
#include<stdarg.h>
int main()
{
fun("TechnoVeta", 1, 4, 7, 11, 0);
return 0;
int tot=0;
va_list ptr;
int num;
va_start(ptr, msg);
printf("%d", num);
A. TechnoVeta 1 7 11 0 B. 1 C. 4 D. 7
#include<stdio.h>
#include<stdarg.h>
int main()
{
dumplist(2, 4, 8);
dumplist(3, 6, 9, 7);
return 0;
va_list p; int i;
va_start(p, n);
while(n -> 0)
i = va_arg(p, int);
printf("%d", i);
va_end(p);
A. B C D
24 248 48 111
36 3, 6, 9, 7 697 1111
#include<stdio.h>
27. What will the SWAP macro in the following program be expanded to on
preprocessing? will the code compile?
#include<stdio.h>
int main()
SWAP(x, y, int);
return 0;
29. If the two strings are identical, then strcmp() function returns
A. -1 B. 1 C. 0 D. Yes
30. The maximum combined length of the command-line arguments including the spaces
between adjacent arguments is
#include<stdio.h>
int get();
int main()
printf("%d", x);
return 0;
int get()
return 20;
#include<stdio.h>
int main()
{
s = str;
while(*s)
printf("%c", *s++);
return 0;
void (*cmp)();