GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 310 of 453    Print  
printf ("%d" ,printf {"tim") );

1. results in a syntax error
2. outputs tim 3
3. outputs garbage
4. prints tim and terminates abruptly

  
Total Answers and Comments: 10 Last Update: March 21, 2009     Asked by: Rujul 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 16, 2007 01:52:01   #1  
Edwin        

RE: printf ("%d" ,printf {"tim") ); 1...
Ans 2.
 
Is this answer useful? Yes | No
March 16, 2007 06:25:13   #2  
saravanaraja        

RE: printf ("%d" ,printf {"tim") ); 1...





Syntax error.

 
Is this answer useful? Yes | No
March 17, 2007 14:44:56   #3  
gaurav_gangwar9        

RE: printf ("%d" ,printf {"tim") ); 1...
syntax error
 
Is this answer useful? Yes | No
March 30, 2007 06:17:06   #4  
vnmurali        

RE: printf ("%d" ,printf {"tim") ); 1...
1. Result in a syntax error.
 
Is this answer useful? Yes | No
February 08, 2008 07:41:40   #5  
Vishwas.p Member Since: February 2008   Contribution: 4    

RE: printf ("%d" ,printf {"tim") ); 1. results in a syntax error 2. outputs tim 3 3. outputs garbage 4. prints tim and terminates abruptly
Well yes it gives out a syntax error for the above code..

But if it was like this : printf(" d" printf("tim"));

Result : tim3

This is because printf function always returns the number of characters printed...

 
Is this answer useful? Yes | No
February 16, 2008 07:13:47   #6  
bismitapadhy Member Since: July 2007   Contribution: 5    

RE: printf ("%d" ,printf {"tim") ); 1. results in a syntax error 2. outputs tim 3 3. outputs garbage 4. prints tim and terminates abruptly
inner printf will print tim and send no of character printed to the next printf statement so it will print 3.
output-->tim3

 
Is this answer useful? Yes | No
February 22, 2008 03:21:39   #7  
vijoeyz Member Since: September 2007   Contribution: 3    

RE: printf ("%d" ,printf {"tim") ); 1. results in a syntax error 2. outputs tim 3 3. outputs garbage 4. prints tim and terminates abruptly
Syntax error.

printf (" d" printf ("tim") ); will print 3.

Thanks
Vijay Zanvar
http://faq.zanvar.in

 
Is this answer useful? Yes | No
February 27, 2008 01:39:53   #8  
gunasekarselvaraj Member Since: February 2008   Contribution: 4    

printf ("%d" ,printf {"tim") ); 1. results in a syntax error 2. outputs tim 3 3. outputs garbage 4. prints tim and terminates abruptly
tim3 is the correct answer. i checked...
 
Is this answer useful? Yes | No
August 13, 2008 11:01:38   #9  
anjani_lahoty Member Since: August 2008   Contribution: 1    

RE: printf ("%d" ,printf {"tim") ); 1. results in a syntax error 2. outputs tim 3 3. outputs garbage 4. prints tim and terminates abruptly
The output will be tim3 because printf() function always return the no of characters printed on the console.
 
Is this answer useful? Yes | No
March 20, 2009 08:18:01   #10  
monuavi26 Member Since: March 2009   Contribution: 2    

RE: printf ("%d" ,printf {"tim") ); 1. results in a syntax error 2. outputs tim 3 3. outputs garbage 4. prints tim and terminates abruptly

The Answer is 2. printf function returns the number of characters printed so it returns 3 and tim is already printed due to the call to printf( tim ). So the output is tim 3.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape