What does the cerr represent?
Which operator is used to create the user-defined streams in c++?
How many types of guarantees are there in exception class can have?
What is the output of this program?
1. #include2. #include 3. using namespace std; 4. int main() 5. { 6. string s = "a long string"; 7. s.insert(s.size() / 2, " * "); 8. cout << s << endl; 9. return 0; 10. }
What is the output of this program?
1. #include2. using namespace std; 3. class MyException 4. { 5. public: 6. MyException(int value) : mValue(value) 7. { 8. } 9. int mValue; 10. }; 11. class MyDerivedException : public MyException 12. { 13. public: 14. MyDerivedException(int value, int anotherValue) : MyException(value), mAnotherValue(anotherValue) 15. { 16. } 17. int mValue; 18. int mAnotherValue; 19. }; 20. void doSomething() 21. { 22. throw MyDerivedException(10,20); 23. } 24. int main() 25. { 26. try 27. { 28. doSomething(); 29. } 30. catch (MyDerivedException &exception) 31. { 32. cout << "\nCaught Derived Class Exception\n"; 33. } 34. catch (MyException &exception) 35. { 36. cout << "\nCaught Base Class Exception\n"; 37. } 38. return 0; 39. }