MCQOPTIONS
Bookmark
Saved Bookmarks
→
C++ Programming
→
Constructors And Destructors in C++ Programming
→
What kind of exceptions are available in c++?..
1.
What kind of exceptions are available in c++?
A.
dynamic
B.
handled
C.
unhandled
D.
static
E.
None of these
Answer» D. static
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
What is the output of this program?<br><pre class="prettyprint lang-c">#include <stdexcept><br> #include <limits><br> #include <iostream><br> using namespace std;<br> void Function(int ch)<br> {<br> if (ch < numeric_limits<char> :: max())<br> throw invalid_argument("Function argument too large.");<br> else<br> {<br> cout< }<br> }<br> int main()<br> {<br> try<br> {<br> Function(150);<br> }<br> catch(invalid_argument& excep)<br> {<br> cout << excep.what() << endl;<br> return -1;<br> }<br> return 0;<br> }<br></char></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> void Example(int n)<br> {<br> try<br> {<br> if (n > 0)<br> throw n;<br> else<br> throw 'L';<br> }<br> catch(char)<br> {<br> cout << "Catch a integer and that integer is :" << n;<br> }<br> }<br> int main()<br> {<br> cout << "Testing multiple catches :";<br> Example(5);<br> Example(0);<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br>#include <exception><br> using namespace std;<br> int main() <br> {<br> try<br> {<br> double* number= new double[200];<br> cout << "Memory allocated...";<br> }<br> catch (exception& excep)<br> {<br> cout << "Exception occurred:" << excep.what() << endl;<br> }<br> return 0;<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> double Div(int num1, int num2)<br> {<br> if (num2 == 0)<br> {<br> throw "Division by zero condition!";<br> }<br> return (num1 / num2);<br> }<br> int main ()<br> {<br> int p = 25;<br> int q = 0;<br> double Res = 0;<br> try <br> {<br> Res = Div(p, q);<br> cout << Res << endl;<br> }<br> catch (const Message) <br> {<br> cerr << Message << endl;<br> }<br> return 0;<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> #include <string><br> using namespace std;<br> int main ()<br> {<br> int n = 5;<br> string str = "Exception Caught: Wrong number used";<br> try<br> {<br> if ( n == 1 )<br> { <br> throw 10;<br> }<br> if ( n == 2 )<br> {<br> throw 3.5f;<br> }<br> if ( n != 1 || n != 2 )<br> { <br> throw str;<br> }<br> }<br> catch (int p)<br> {<br> cout << "Exception value is: " << p << endl;<br> }<br> catch (float q)<br> {<br> cout << "Exception value is: " << q << endl;<br> }<br> catch (string str)<br> {<br> cout << str << endl;<br> }<br> return 0;<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <stdexcept><br> #include <limits><br> #include <iostream><br> using namespace std;<br> void Function(char ch)<br> {<br> if (ch < numeric_limits<char>::max())<br> return invalid_argument;<br> }<br> int main()<br> {<br> try<br> {<br> Function(50);<br> }<br> catch(invalid_argument& excep)<br> {<br> cout << excep.what() << endl;<br> return -1;<br> }<br> return 0;<br> }<br></char></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> void DivFunction(const double num1, const double num2);<br> int main()<br> {<br> double option1=20, option2=5;<br> try <br> {<br> DivFunction(option1, option2);<br> }<br> catch (const char* S)<br> {<br> cout << "Bad Operator caught: " << S;<br> }<br> return 0;<br> }<br> void DivFunction(const double num1, const double num2)<br> {<br> double Res;<br> if (num2 == 0)<br> throw "Division by zero not allowed";<br> Res = num1 / num2;<br> cout << Res;<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> #include <typeinfo><br> using namespace std;<br> class shapeClass<br> {<br> public:<br> virtual void Virtualfunc() const {}<br> };<br> class NewTriangle: public shapeClass<br> {<br> public:<br> virtual void Virtualfunc() const<br> { <br> };<br> };<br> int main()<br> {<br> shapeClass shape_object;<br> shapeClass &Ref_shape = shape_object;<br> try <br> {<br> NewTriangle &Ref_NewTriangle = dynamic_cast<NewTriangle&>(Ref_shape);<br> }<br> catch (bad_cast) <br> {<br> cout << "Exception caught by bad_cast";<br> }<br> return 0;<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int main()<br> {<br> char* p;<br> unsigned long int num = (size_t(0) / 3);<br> cout << num << endl;<br> try<br> {<br> p = new char[size_t(0) / 3];<br> delete[ ] p;<br> }<br> catch(bad_alloc &TheBadAllocation)<br> {<br> cout << TheBadAllocation.what() << endl;<br> };<br> return 0;<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> #include <exception><br> using namespace std;<br> int main () <br> {<br> try<br> {<br> float* myarray= new float[125];<br> cout << "Memory Allocated";<br> }<br> catch (exception& excep)<br> {<br> cout << "Standard exception: " << excep.what() << endl;<br> }<br> return 0;<br> }<br></pre>
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply