Friday, 19 October 2012

C programming Quiz 1-5

C programming Quiz 1-5

<--Previous                                           Page number: 1,2,3                                                   Next-->
Quiz 1:

#include
int main(){
int arr[]={6,12,18,24};
int x=0;
x=arr[1]+(arr[1]=2);
printf("x=%d",x);
return 0;



Quiz 2:

int main(){
int x,a=2;
x=++a,++a,a++;
printf("x=%d,a=%d",x,a);
return 0;
}



Quiz 3:
int main()
{
int p=-2,q=0,r=0,s;
clrscr();
s=++p || ++q && ++r;
printf("p=d, q=%d, r=%d, s=%d",p,q,r,s);
getch();
return 0;
}



Quiz 4:
main ()
{
unsigned int i;

for (i = 10; i >= 0; i--)
printf ("%d", i);
}
Options:
a) prints numbers 10 - 0
b) prints nos 10 - 1
c) goes into infinite loop




Quiz 5:

int main()
{
int a=-1,b=0,c=0,d=-1,res;
res=++a || b++ && c++ || ++d;
printf("a=%d,b=%d,c=%d,d=%d,res=%d",a,b,c,d,res);
return 0;
}


<--Previous                        Page number: 1,2                                                                            Next-->

In case of any explanation kindly comment!

DON'T FORGET TO JOIN THIS BLOG.. SHARE IT WITH YOUR FRIEND!

No comments:

Post a Comment