Classical

C Programming MCQ - I/O Operations

16:  

Replacing > by < in the previous question results in

A.

printing of 107

B.

a syntax error

C.

printing of k

D.

none of the above

 
 

Option: A

Explanation :


17:  

 If a = 9, b = 5 and c = 3, 
then the expression ( a - a/b * b % c) > a % b % c
evaluates to

A.

true

B.

false

C.

invalid

D.

0

 
 

Option: A

Explanation :


18:  

Consider the declaration 

static char hello[ ] = " hello " ;
The output of printf( " % s \ n ", hello) ;


will be the same as that of

A.

puts(" hello ");

B.

puts( hello );

C.

printf(" %s \ n", " hello ") ;

D.

puts( " hello \ n ") ;

 
 

Option: C

Explanation :


19:  

The following program

main()
{
printf ("tim");
main( ) ;
}

A.

is illegal

B.

keeps on printing tim

C.

prints tim once

D.

none of the above

 
 

Option: B

Explanation :

This involves recursion - main ( ) calling itself. So, it keeps on printing tim.


20:  

Consider the following program.
main()
{
putchar ( 'M' );
   first();
   putchar ( 'm');
}
first ( )
{ _____ }
second ( )
{
putchar ( 'd');
}


If Madam is the required output, then the body of first ( ) must be

A.

empty

B.

second( ) ; putchar ( 'a' );

C.

 putchar( 'a' ) ; second(); printf ("%c", 'a' );

D.

none of the above

 
 

Option: C

Explanation :

Since madam is the required output. the function first( ) . should print ' a ' call the function second ( ) that prints the 'd' and print ' a ' again. Hence c is the correct answer.




Suggest an improvement