Programming in C - I/O Operations

19. The following program
main()
{
printf ("tim");
main( ) ;
}

  • Option : B
  • Explanation :
    This involves recursion - main ( ) calling itself. So, it keeps on printing tim.
Cancel reply
Cancel reply

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

  • 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.
Cancel reply
Cancel reply