You are on page 1of 3

Question Paper of C

Duration: 1 hour

Q1.

In which stage the following code #include<stdio.h> gets replaced by


the contents of the file stdio.h?

Q2.

Which function is used to find the first occurrence of a given string in


another string?

Q3.

What is the size and range of long double data type on a 16- bit
Machine?

Q4.

What are tri-graph characters? How are they useful?

Q5.

Write the output of the following program.


#include<stdio.h>
typedef void v;
typedefint i;
int main()
{
v fun(i, i);
fun(2, 3);
return 0;
}
v fun(i a, i b)
{
i s=2;
float i;
printf("%d,", sizeof(i));
printf(" %d", a*b*s);
}

Q6.

Which files will get closed through fclose() in the following program?
#include<stdio.h>
int main()
{
FILE *fs, *ft, *fp;
fp = fopen("A.C", "r");
fs = fopen("B.C", "r");
ft = fopen("C.C", "r");
fclose(fp, fs, ft);
return 0;
}

Q7.

Out of fgets() and gets() which function is safe to use and Why?
Explain.

Q8.

What will the swap macro in the following program be expanded to


on preprocessing? Will the code compile? Explain.
#include<stdio.h>
#define SWAP(a, b, c)(c t; t=a, a=b, b=t)
int main()
{
int x=10, y=20;
SWAP(x, y, int);
printf("%d %d\n", x, y);
return 0;
}

Q9.

What is the x in the following program?


#include<stdio.h>
int main()
{
typedef char (*(*arrfptr[3])())[10];
arrfptr x;

return 0;
}
Q10. In the below code atexit() function is not called? Give reason for
support your answer.
#include<stdio.h>
voidfunc(void)
{
printf("\n Cleanup function called \n");
return;
}
int main(void)
{
int i = 0;
atexit(func);
for(;i<0xffffff;i++);
_exit(0);
}

You might also like