Logo 
Search:

C++ Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C++ ProgrammingRSS Feeds

What will be the output of the mentioned code?

  Shared By: Waggoner Fischer    Date: Dec 10    Category: C++ Programming    Views: 670

Answer:

Consider the following code segment:
void main()
{
string s1("Time and tide wait for none");
int f;
f=s1.find("t");
cout<<endl<<f;
f=s1.find_first_of("t");
cout<<"\t"<<f;
f=s1.find_last_of("t");
cout<<"\t"<<f;
f=s1.find_first_not_of("t");
cout<<"\t"<<f;
f=s1.find_last_not_of("t");
cout<<"\t"<<f;
}
What will be the output of the above code?

Options

a) 0 0 17 1 26
b) 0 9 17 0 26
c) 9 0 17 0 26
d) 9 9 17 0 26

Answer : d) 9 9 17 0 26

Share: 
 

Didn't find what you were looking for? Find more on What will be the output of the mentioned code? Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: