21. Find the output of the following program.
#include<stdio.h>
void main()
{
int y=10;
if(y++>9 && y++!=10 && y++>11)
printf("%d", y);
else
printf("%d", y);
}
#include<stdio.h>
void main()
{
int y=10;
if(y++>9 && y++!=10 && y++>11)
printf("%d", y);
else
printf("%d", y);
}
22. What will be the value of sum after the following program is executed?
void main()
{
int sum=1, index = 9;
do{
index = index – 1;
sum *= 2;
}while( index > 9 );
}
void main()
{
int sum=1, index = 9;
do{
index = index – 1;
sum *= 2;
}while( index > 9 );
}
23. What is the right choice, if the following loop is implemented?
void main()
{
int num = 0;
do{
--num;
printf("%d", num);
}while( ++num >= 0 );
}
void main()
{
int num = 0;
do{
--num;
printf("%d", num);
}while( ++num >= 0 );
}
24. What will be the final value of the digit?
void main()
{
int digit = 0;
for( ; digit <= 9; )
digit++;
digit *= 2;
--digit;
}
void main()
{
int digit = 0;
for( ; digit <= 9; )
digit++;
digit *= 2;
--digit;
}
25. What will be the following code's output if choice = 'R'?
switch(choice)
{
case 'R' : printf("RED");
case 'W' : printf("WHITE");
case 'B' : printf("BLUE");
default : printf("ERROR");break;
}
switch(choice)
{
case 'R' : printf("RED");
case 'W' : printf("WHITE");
case 'B' : printf("BLUE");
default : printf("ERROR");break;
}