1. The general catch handler must be placed after the exception block. If placed before, it will execute before any exceptions are thrown.
2. Exceptions like BadClassCastException occur when an explicit conversion to a base class or interface fails. ArgumentException occurs when the argument passed to a method is invalid.
3. The four steps for handling runtime exceptions are: 1) Exception occurs 2) Exception is caught 3) Exception is handled 4) Program resumes execution.
1. The general catch handler must be placed after the exception block. If placed before, it will execute before any exceptions are thrown.
2. Exceptions like BadClassCastException occur when an explicit conversion to a base class or interface fails. ArgumentException occurs when the argument passed to a method is invalid.
3. The four steps for handling runtime exceptions are: 1) Exception occurs 2) Exception is caught 3) Exception is handled 4) Program resumes execution.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
1. The general catch handler must be placed after the exception block. If placed before, it will execute before any exceptions are thrown.
2. Exceptions like BadClassCastException occur when an explicit conversion to a base class or interface fails. ArgumentException occurs when the argument passed to a method is invalid.
3. The four steps for handling runtime exceptions are: 1) Exception occurs 2) Exception is caught 3) Exception is handled 4) Program resumes execution.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
Date____________ Students Name: ____________________________________________ Roll No: Write the proper a) Must be 1 What if the general catch handler is placed match executed 1 before Exception block or Exception block 1. Bad class cast : b) Runtime before IOException ______ c)Variable ___________________________________________ 2. DivideByZeroEx argument ___________________________________________ ception__ d) Before ___________________________________________ 3. byte program start b=(int)3d :___ e) ArithmeticEx 4. finally : _______ ception int wwf= 2147483333 for(int i=0;i<2;i--) 1 Complete the following 1) unchecked(wwf *= 2 123456);___________________ Exception ___________________________________________ 2) checked(wwf *= 123456);_____________________ ___________________________________________ Advantage of using general catch handler. ___________________________________________ DivideByZeroException ___________________________________________ ___________________________________________ When explicit conversion to base class or 1 How CLR reacts for unhandled run time interface fails _______________________ 3 errors. ______ exception is raised. ____________________________________________ ArgumentException occurs when ____________________________________________ _______________ ____________________________________________ ___________________________________________ Write the execution sequence of following; 1 State whether the following are run time or Line 1. UP: try { double a = 20, 4 compile time errors or no error or both: b=double.Parse(0d); 1) int zero=1, one=zero; zero = one % Line 2. Console.WriteLine(A = {0} B= 1.0;__________ {1},a,b);} 2) if(a==(b=c) ) msg=heee Line 3. catch(FormatException fe) ____________________ Line 4: {Console.Write(fe) ; goto UP;} 3) ArrayList c; c.Add(); Line 5. finally{Console.WriteLine(Long _______________________ wait to run); } 4) string @if= @if; Answer :Line ____ Line _____ Line ____ ________________________ Line _____ Then ______________________________________ Comment on finally 1 Four steps for handling run time exception block_______________________ 5 1. _________________ 2. _____________________ ____________________________________________ 3. _________________ 4. _____________________ ____________________________________________ ____________________________________________ List 2 compile time errors: 1) Answer the following question _____________________ 1) Why C# is versonable and ____________________________________________ interoperable? -- 3 2) __________________________________________
1 0
Two Differences between run time and
compile time errors 1.____________________________________ ___________________________________________ 2) _________________________________________ ___________________________________________ How to create custom exceptions __________________________________________ __________________________________________ __________________________________________ __________________________________________ 1) Every catch must have error handling code. Yes / No. 2) All .Net exceptions are derive of System.Exception Y / N
Compare C#, C++ and Java
w. r. t. following points -- 3 a) Releasing Memory b) Accessibility of member. c) Boolean data type. 3) List any six applications of C#. ---- 3 4) Briefly explain origin of C#. ---- 3 5) Any six features of C# --- 3 2)
Marks Obtained __________ in Words ___________________________ Signature of the