1. Difference between static & non-static variables.
2. Define Pointers
3. Write your own String Copy function.
4. What is the purpose of Volatile in C.
5. What is the purpose of Static in C?
6. One question was like
static int x;
It will be acessed by-------- in a file 1.c {Hint: It is
based on scope of variables}
7. What is the Output?
main()
{
char *p1="name";
char *p2;
p2=(char*)malloc(20);
memset(p2,0,20); // Plz check it
out {Appendix of YPK--C}
while(*p2++
= *p1);
printf("%s\n",p2);
}
8. Long function
based on command line arguments, u have 2 find out the error...
Ans: I think some error in 2nd If condition.
9. What is ths Output of given snippet?
void main()
{
int x=20,
y=35;
x= x++ + y++;
y= y++ + x++;
printf("%d%d", x,y);
}
10. main()
{
char s1[] =
"XYZ";
char s2[] =
"inc";
printf("%s", s1);
}
11. Simple strcat
code was given.
Ans: XYZinc
12. #define TRUE 0
----------- Some
code
while(TRUE)
{
----------
Some code
}
what is the
Output?
13. main()
{
int
x=10,y=15;
x= x++;
y= y++;
printf("%d%d",x,y);
}
What is the output?
14. int a;
if(a==0)printf("XYZ");
printf("XYZ");
What is the
output?
15. int x;
int modify(int
x)
{
return(x+=10);
}
int
changevalue(int x)
{
return(x+=1);
}
void main()
{
int x=10;
x++;
modify(x);
x++;
printf("%d",x);
x++;
changevalue(x);
x++;
modify(x);
printf("%d",x);
}
16. Difference
between malloc and calloc and implement maoolc as calloc.
17. Implement
realloc with full error checking code.
18. Implement a
in-memory look up table of int type and write a function having time
complexity of
O(logn).
19. Program for
converting binary>>>decimal or
similat to this.
20. void main()
{
int x= 5;
printf("%d%d%d",x,x<<2,x>>2);
}
21. #define
swap(a,b) a=a+b; b=a-b; a=a-b;
void main()
{
int x=5, y=10;
swap(x,y);
printf("%d%d", x, y);
swap2(x,y);
printf("%d%d",
x, y);
}
swap2(int a,
int b)
{
int temp;
temp=a;
a=b;
b=temp;
}
what is the Output?
22. void main()
{
char *ptr=
"xyz";
*ptr++;
printf("%d\n", ptr);
ptr++;
printf("%d", ptr);
}
23. Explain the given declerations
char *const ptr;
char
const *ptr;
similar
to this // Its pointer to constant and conastant pointer