| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. If inner catch block is unable to handle the exception thrown then__________

Correct Answer is : arg()

2. In nested try catch blocks, if both inner and outer catch blocks are unable to handle the exception thrown, then ______________

Correct Answer is : 1.03038

3. Which function is invoked when an unhandled exception is thrown?

Correct Answer is : Used to construct a complex number from magnitude and phase angle

4. How one can restrict a function to throw particular exceptions only?

Correct Answer is : Complex number with magnitude 5.83095 and phase angle 1.03038 is: (3,5)

5. Which function is invoked when we try to throw an exception that is not supported by a function?

Correct Answer is : norm()

6. Return type of uncaught_exception() is________________

Correct Answer is : 25

7. What is the output of the following C++ code? #include using namespace std; int main() { int var = -12; try { cout<<"Inside try\n"; if (var < 0) { throw var; cout<<"After throw\n"; } } catch (int var ) { cout<<"Exception Caught\n"; }   cout<<"After catch\n"; return 0; }

Correct Answer is : conj()

8. What is the output of the following C++ code? #include using namespace std; int main() { int var = -12; try { cout<<"Inside try\n"; if (var < 0) { throw var; cout<<"After throw\n"; } } catch (char var ) { cout<<"Exception Caught\n"; }   cout<<"After catch\n"; return 0; }

Correct Answer is : Conjugate of 3+(4)i is: 3+(-4)i

9. What is the output of the following C++ code? #include using namespace std; int main() { try { try { throw 20; } catch (int n) { cout << "Inner Catch\n"; } } catch (int x) { cout << "Outer Catch\n"; } return 0; }

Correct Answer is : Used to calculate the projection of a complex number

10. What is the output of the following C++ code? #include using namespace std; int main() { try { try { throw 20; } catch (char n) { cout << "Inner Catch\n"; } } catch (int x) { cout << "Outer Catch\n"; } return 0; }

Correct Answer is : proj(3,4) : (3,4)

11. What is the output of the following C++ code? #include using namespace std; int main() { try { try { throw 20; } catch (int n) { cout << "Inner Catch\n"; throw; } } catch (int x) { cout << "Outer Catch\n"; } return 0; }

Correct Answer is : To calculate the log of a complex number

12. Which of the following is true about exception handling in C++? i) There is a standard exception class in C++ similar to Exception class in Java. ii) All exceptions are unchecked in C++, i.e., the compiler does not checks if the exceptions are caught or not. iii) In C++, a function can specify the list of exceptions that it can throw using comma separated list like following. void fun(int a, char b) throw (Exception1, Exception2, ..)

Correct Answer is : (1.60944,0.927295)

13. What is meant by exception specification?

Correct Answer is : (3.85374,-27.0168)

14. Identify the correct statement about throw(type).

Correct Answer is : complex

15. What will happen when a programs throws any other type of exception other than specified?

Correct Answer is : complex(3,4)

16. What do you mean by “No exception specification”?

Correct Answer is : (6.12132, 3.70711)

17. Which operations don’t throw anything?

Correct Answer is : cartesian

18. To where does the program control transfers when the exception is arisen?

Correct Answer is : 2

19. Which keyword is used to check exception in the block of code?

Correct Answer is : literals

20. What will happen when the exception is not caught in the program?

Correct Answer is : all of the mentioned