I am giving some of the questions asked in written test in C programming
1.main()
{
int c[]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<=5;j++)
{
Printf(“%d”,*c);
++q;
}
For(j=0;j<5;j++)
{
Printf(“%d”,*p);
++p;
}
}
ANS: 2222223645
2. main()
{
Struct xx
{
int x=3;
char name[]=”hello”;
};
Struct xx *s;
Printf(“%d”,s?x);
Printf(“%d”,s?name);
}
ANS :Compiler error
3.void main()
{
Static int i=i++,j=j++,k=k++;
Printf(“%d%d%d”,i,j,k);
}
ANS: 111
4. write a program to add 1&1 without using + operator
5. main()
{
int c[]={2,4,6,7,8},*p;
printf(%u/n”,p);
}
6. How can u return multiple values in C language.
7.main()
{
int a[2][3][2]={{{2,4}{7,8}{3,4}}{{2,2}{2,3}{3,4}}};
printf(“%u%u%u%d\n”,a,*a,**a,***a);
printf(“%u%u%u%d\n”,a+1,*a+1,**a+1,***a+1);
}
ANS: 100,100,100,2
104,104,102,3
8. One question given from algorithm find the output.
9. one question given from datastructures
10. one question given from Pointers.
No comments:
Post a Comment