C - Control Flow Constructions Questions and Answers
Practice ModeShowing 10 of 62 questions
Q41
main ( )
{
int i = 0;
for ( ; ++ i ;)
printf ( "%d", i );
}
How many times the for loop will be executed ?
Answer: Option D
Q42
main ( )
{
unsigned int i =10 ;
while ( i - - > = 0) ;
}
How many times the loop will be executed ?
Answer: Option D
Q43
main ( )
{
int score = 4 ;
switch (score)
{
default :
;
case 3 :
score +=5;
if ( score == 8)
{
score ++;
if (score == 9) break ;
score *= 2;
}
score -=4;
break;
case 8:
score +=5;
break ;
}
printf ("score = %d\n", score);
}
What will be the output of the above code ?
Answer: Option A
Q44
main ( )
{
int score = 4;
switch (score)
{
default:
;
case 3 :
score += 5;
if ( score = = 8)
{
score++;
if ( score = = 9) break ;
score *= 2;
}
score -=4;
break;
case 8:
score +=5;
break;
}
printf ( "SCORE = %d\n", score);
}
What will be the output of the above code ?
Answer: Option A
Q45
switch (s)
{
case 1 : printf ("Balan")
case 2 :
case 3 : printf ("Elango")
case 4 : printf ("Thiruvalluvan")
default : printf ("Kamban")
}
To print only Kamban, what will be the value of s ?
Answer: Option C
Q46
main ( )
{
int a =-4, r, num = 1;
r = a% -3;
r = ( r ? 0 : num * num) ;
printf ("%d". r);
}
What will be the output of the program ?
Answer: Option A
Q47
main ( )
{
int a =-4, r, num = 1;
r = a% -3;
r = ( r ? 0 : num * num) ;
printf ("%d". r);
}
What will be the output of the program ?
Answer: Option A
Q48
What is the value of int variable result if x = 50, y = 75 and z = 100?
result = ( x + 50 ? y >= 75 ? z > 100 ? 1 : 2 : 3 : 4 ) ;
Answer: Option B
Q49
Omitting the break statement from a particular case
Answer: Option C
Q50
int i ;
i=2;
i++;
if (i = 4)
{
printf "i=4");
}
else
{
printf("i=3");
}
what is the out of the program ?
Answer: Option A