C - Control Flow Constructions
C - Control Flow Constructions
31. When is default statement executed in swich-case construct ?
- Whenever there is exactly one match
- whenever break statement is omitted in all case statements.
- Whenever there is no match with case labels.
- options b and c.
32. C is an example of
- object oriented language
- structured programming language
- object based language
- component based language
33. The syntax of if statement is
- If expression then program -statement
- if (expression) program - statement
- if (expression) then program-statement
- if expression { program- satement}
34. main ( )
{
int a = 2, b = 4, c =8, x =4;
if ( x == b ) x = a; else x = b;
if ( x ! = b ) c = c + b ; else c = c +a ;
printf ( "c = %d\n", c );
}
What will be printed when the above code is executed ?
{
int a = 2, b = 4, c =8, x =4;
if ( x == b ) x = a; else x = b;
if ( x ! = b ) c = c + b ; else c = c +a ;
printf ( "c = %d\n", c );
}
What will be printed when the above code is executed ?
- c = 4
- c = 8
- c = 10
- c = 12
35. main ( )
{
unsigned int x = -10; int y = 10 ;
if ( y <= x ) printf ("He is good \n");
if ( y = = ( x = -10) ) printf (" She is better/n");
if ( ( int ) x = = y) printf ("It is the best\n");
}
What will be the output of above sample code ?
{
unsigned int x = -10; int y = 10 ;
if ( y <= x ) printf ("He is good \n");
if ( y = = ( x = -10) ) printf (" She is better/n");
if ( ( int ) x = = y) printf ("It is the best\n");
}
What will be the output of above sample code ?
- She is better
- He is good It is the best
- It is the best
- He is good
36. If ( 3.14) printf (" The vaLue of exponent\");
else printf ("The value of PIE is used in conditional part\n");
What might bethe result ?
else printf ("The value of PIE is used in conditional part\n");
What might bethe result ?
- Float value can't be given in conditional part.
- The value of PIE is used in conditional part.
- The value of exponent.
- None of the above.
37. main ( )
{
int x ;
If ( x > 4 ) printf ( "Brindha");
else if ( x > 10 ) printf ( " Karthik");
else if ( x > 21) printf ( " Pradeep");
else printf (" Sandeep");
}
What will be the value of x so that "Karthik" willbe printed?
{
int x ;
If ( x > 4 ) printf ( "Brindha");
else if ( x > 10 ) printf ( " Karthik");
else if ( x > 21) printf ( " Pradeep");
else printf (" Sandeep");
}
What will be the value of x so that "Karthik" willbe printed?
- from 10 ti 21
- from 11 to 21
- greater than 10
- none.
38. main ( )
{
i = 0; j = 0;
for ( j = 1; j <10; j++)
{i = i+1; }
}
In the (generic) segment above, what will be the value of the variable i on completion ?
{
i = 0; j = 0;
for ( j = 1; j <10; j++)
{i = i+1; }
}
In the (generic) segment above, what will be the value of the variable i on completion ?
- 1
- 3
- 9
- 10
39. main ( )
{
int x = 0;
for ( (x = 1; x < 4; x++);
printf (" x =%d\n", x);
}
What will be printed when the above sample is executed ?
{
int x = 0;
for ( (x = 1; x < 4; x++);
printf (" x =%d\n", x);
}
What will be printed when the above sample is executed ?
- x = 0
- x = 1
- x = 3
- x = 4
40. main ( )
{
int x = 0;
for (; ; )
{
if (x++ = 4) break ;
continue;
printf ("x=%d\n",x);
what will be printed when the above code is executed ?
{
int x = 0;
for (; ; )
{
if (x++ = 4) break ;
continue;
printf ("x=%d\n",x);
what will be printed when the above code is executed ?
- x = 0
- x = 1
- x = 4
- x = 5