Home / MCQ Bank / Computer
Computer Plus Plus Miscellaneous Difficulty: Medium

What will be the output of the following C++ code? #include <iostream> using namespace std; void test(int x) { try { if (x > 0) throw x; else throw 'x'; } catch(char) { cout << "Catch a integer and that integer is:" << x; } } int main() { cout << "Testing multiple catches\n:"; test(10); test(0); }

Select the correct option to test your answer:

More Computer Questions

What will be the output of the following Python code? import turtle t=turtle.Pen() t.clear() t.isvisible() Which of the following does not use a crawler to find pages for the search result? What will be the output of the following Python code snippet? print('cd'.partition('cd')) Which of the following is not a way to cut text? How many times is the function recursive_min_element() called when the following code is executed? int min_of_two(int a, int b) { if(a < b) return a; return b; } int recursive_min_element(int *arr, int len, int idx) { if(idx == len - 1) return arr[idx]; return min_of_two(arr[idx], recursive_min_element(arr, len, idx + 1)); } int main() { int n = 10, idx = 0, arr[] = {5,2,6,7,8,9,3,-1,1,10}; int min_element = recursive_min_element(arr,n,idx); printf("%d",min_element); return 0; }