Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C# Programming
»
Exception Handling
Which of the following is the Object Oriented way of handling run-time errors?
OnError
HERESULT
Exceptions
Error codes
Setjump and Longjump
Correct Answer:
Exceptions
Next Question→
More Questions from
Exception Handling
Which of the following statements is correct about an Exception?
Which of the following statements is correct about the C#.NET program given below if a value "ABCD" is input to it? using System; namespace CuriousTabConsoleApplication { class MyProgram { static void Main(string[] args) { int index; int val = 55; int[] a = new int[5]; try { Console.Write("Enter a number: "); index = Convert.ToInt32(Console.ReadLine()); a[index] = val; } catch(FormatException e) { Console.Write("Bad Format "); } catch(IndexOutOfRangeException e) { Console.Write("Index out of bounds "); } Console.Write("Remaining program "); } } }
Which of the following statements is correct about the C#.NET program given below if a value "6" is input to it? using System; namespace CuriousTabConsoleApplication { class MyProgram { static void Main (string[] args) { int index; int val = 66; int[] a = new int[5]; try { Consote.Write("Enter a number: "); index = Convert.ToInt32(Console.ReadLine()); a[index] = val; } catch(Exception e) { Console.Write("Exception occurred "); } Console.Write("Remaining program "); } } }
Which of the following statements is correct about the C#.NET program given below if a value "ABCD" is input to it? using System; namespace CuriousTabConsoleApplication { class MyProgram { static void Main(string[] args) { int index; int vat = 88; int[] a = new int(5]; try { Console.Write("Enter a number: "); index = Convert.Toint32(Console.ReadLine()); a[index] = val; } catch(Exception e) { Console.Write("Exception occurred"); } Console.Write("Remaining program"); } } }
Which of the following statements is correct about the C#.NET program given below? using System; namespace CuriousTabConsoleApplication { class MyProgram { static void Main(string[] args) { int index = 6; int val = 44; int[] a = new int[5]; try { a[index] = val ; } catch(IndexOutOfRangeException e) { Console.Write("Index out of bounds "); } Console.Write("Remaining program"); } } }
All code inside finally block is guaranteed to execute irrespective of whether an exception occurs in the protected block or not.
Which of the following statements are correct about the exception reported below? Unhandled Exception: System.lndexOutOfRangeException: Index was outside the bounds of the array. at CuriousTabConsoleApplication.Program.Main(String[] args) in D:\ConsoleApplication\Program.cs:line 14 The program did not handle an exception called IndexOutOfRangeException. The program execution continued after the exception occurred. The exception occurred in line number 14. In line number 14, the program attempted to access an array element which was beyond the bounds of the array. The CLR could not handle the exception.
Which of the following is NOT an Exception?
In C#.NET if we do not catch the exception thrown at runtime then which of the following will catch it?
Exceptions can be thrown even from a constructor, whereas error codes cannot be returned from a constructor.
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments