Home / MCQ Bank / Computer
Computer Plus Plus Miscellaneous

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int x = -1; char *ptr; ptr = new char[256]; try { if (x < 0) { throw x; } if (ptr == NULL) { throw " ptr is NULL "; } } catch (...) { cout << "Exception occurred: exiting "<< endl; } return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • exception occured: exiting

Related Computer Questions

______ has made it easier to exchange text files across the world. Which of this method of class StringBuffer is used to concatenate the string representation to the end of invoking string? How many collision domains are created when you segment a network with a 12-port switch? What will be the class of the vector if you concatenate a number and a character? The letters of a word are separated by a space of how many units?