What will happen if we use the operator "new" and the memory cannot be allocated?

Given:
#include #include using namespace std;
int main () { try
{
int * myarray= new int[1000];
}
catch (bad_alloc&)
{
cout << "Error allocating memory"; } catch (exception& e) { cout << "Standard exception"; } catch (...) { cout << "Unknown exception"; } return 0; } What will happen if we use the operator "new" and the memory cannot be allocated? A. It prints: Error allocating memory
B. It prints: Standard exception
C. It prints: Unknown exception
D. Compilation error

Download Printable PDF. VALID exam to help you PASS.

Posted in: CPA

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.