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: Abe Fischer    Date: Nov 21    Category: C++ Programming    Views: 646

Answer:

Consider the following code segment:
void main()
{
string s1("example");
string s2("2468");
s1.insert(2,s2);
s1.erase(3,5);
s1.replace(2,3,s2);
cout<<s1;
cout<<endl;
}
What will be the output of the above code?

Options

a) ex2468ample
b) ex2ple
c) ex2468e
d) None of the above

Answer : c) ex2468e

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: