Question from the C++ test

What is the output of the following code? #include <iostream> #include <string> using namespace std; int main() { int a = 10; int b = 20; int c = a + b; cout << c; return 0; }

Hard

What is the output of the following code:

int main(int argc, char *argv[])
{
        	
        	try
        	{
     	           	char* ptr;
     	  
     	           	strcpy(ptr, "C++ world");
     	  
     	           	ptr++;
     	  
     	           	std::cout<<ptr<<std::endl;
        	}
        	catch(...)
        	{
  	              	std::cout<<"caught some unhandled exception"<<std::endl;
        	}
        	return 0;
}

Author: Abha AgrawaStatus: PublishedQuestion passed 400 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!