## avsatheesh -2

number of iterations in the following loop

``````main()
{ int x=5, y=10, z=9
for (;x<=5;)
{y++;z--;
x=x+1/2;
if(z==0) z=y;}}``````

## Ancient Dragon 5,243

Number of iterations? Infinite. Why? because 1/2 = 0 (integer division) so the value of x will never change.

## avsatheesh -2

What will be the output of the following code segment (assuming sizeof (int) returns 4)

``````int i= 0x1<<sizeof (int)*8-1;
printf("\n%x", i);
i=i>>sizeof(int)*8-1;
printf("%d",i);``````

## avsatheesh -2

Which one is the valid statement in C?
A)#define half(x) ((x/2.0)
B)#define STREQ(s1,s2) (strcmp((s1),(s2))==0);
C)#define MAX=5

## avsatheesh -2

Choose the correct option to find maximum of the three interger variables.
A) (a>b)?((a>c)?a:c):((b>c)?b:c)
B)(a>b)?((b>c)?b:c):((a>c)?a:c)
C)(a>b)?((c>b)?a:c):((a>c)?a:c)
D) None

## avsatheesh -2

What is the effect of the following code?

``````main()
{
int option=4;
switch(option/2)
{
case 1: printf("EAST");
case 2: printf("WEST");
case 3: printf("NORTH");
case 4: printf("SOUTH");
}
}``````
commented: Do your own damn homework! -2

## thomas_naveen 105

commented: Yes. +27

## Ancient Dragon 5,243

What is the effect of the following code?
main()
{
int option=4;
switch(option/2)
{
case 1: printf("EAST");
case 2: printf("WEST");
case 3: printf("NORTH");
case 4: printf("SOUTH");
}
}

Hint: there are no break statements between the cases.