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 :

Click on Discuss to view users comments.

Write your comments here:



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 :

Click on Discuss to view users comments.

Write your comments here:



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 :

Click on Discuss to view users comments.

Write your comments here:



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.

Click on Discuss to view users comments.

Write your comments here:



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.

Click on Discuss to view users comments.

Write your comments here: