GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Oracle  >  Aptitude
Go To First  |  Previous Question  |  Next Question 
 Aptitude  |  Question 16 of 40    Print  
What is the o/p of the following C-program?
Main()
{
Char str[7]="strings";
Printf("%s",str);
}


  
Total Answers and Comments: 8 Last Update: July 05, 2008   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Asdf
 
Index overflow due to inability of accomodation of '\0' character

Above answer was rated as good by the following members:
rickyheartthrob2004
August 04, 2005 02:59:30   #1  
priya        

RE: What is the o/p of the following C-program?Main(){Char str[7]="strings";Printf("%s&qu...
strings
 
Is this answer useful? Yes | No
November 29, 2005 01:52:42   #2  
Asdf        

RE: What is the o/p of the following C-program?Ma...
Index overflow due to inability of accomodation of '\0' character
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
June 15, 2006 04:00:27   #3  
sharmilabit Member Since: June 2006   Contribution: 3    

RE: What is the o/p of the following C-program?Ma...
There will be a compiler error.....since uppercase letters are used while writing main() and printf() functions...
 
Is this answer useful? Yes | No
June 30, 2006 14:14:50   #4  
Partha006 Member Since: June 2006   Contribution: 6    

RE: What is the o/p of the following C-program?Ma...

This problem doesnt cause any kind of error!!! this is really tricky.. the size of the string strings is 7 but it terminates with a char. thus causing the total size to 8.

here in this case some abserd value will come as an output..

if the size of the array is less than 7 then it ll give the error too many initilization

and if the size is more than7 then the output ll be perfect and strings


 
Is this answer useful? Yes | No
August 14, 2006 03:44:56   #5  
Neo        

RE: What is the o/p of the following C-program?Ma...
Wht about the syntax errors guys ???
 
Is this answer useful? Yes | No
August 24, 2006 14:47:39   #6  
Ambarish        

RE: What is the o/p of the following C-program?Ma...

ans: cannot be determind.

But i case tc++ compiler it print strings@

where @ is the special character.


 
Is this answer useful? Yes | No
January 05, 2007 05:18:55   #7  
       

RE: What is the o/p of the following C-program?Ma...
strings
 
Is this answer useful? Yes | No
July 05, 2008 05:15:29   #8  
aniace Member Since: June 2008   Contribution: 5    

RE: What is the o/p of the following C-program?Main(){Char str[7]="strings";Printf("%s",str);}
array index overflow during compilation

 
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