Home / C# Programming / Exception Handling :: General Questions

C# Programming :: Exception Handling

  1. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

     

     

     

     

     

  2. A.

    1 only 

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

     

     

     

     

     

     

  4. A.

    sass

    1 only 

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

     

     

     

     

     

     

     

  6. A.

     

    1 only 

     

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

     

     

     

     

     

     

     

     

     

  8. A.

     

    1 only 

     

     

     

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

     

     

     

     

     

     

     

     

     

  10. A.

     

    1 only 

     

     

     

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

  12. A.

     

    1 only 

     

     

     

     

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

  14. A.

     

    1 only 

     

     

     

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. 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 FreshergateConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 26 at FreshergateConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\FreshergateConsoleApplication\MyProgram.cs:line 20

    1. The CLR failed to handle the exception.
    2. The class MyProgram belongs to the namespace MyProgram.
    3. The function SetVal() was called from Main() in line number 20.
    4. The exception occurred in line number 26 in the function SetVal()
    5. The runtime exception occurred in the project FreshergateConsoleApplication.

     

  16. A.

    1 only

    B.

    1 and 2 only

    C.

    3, 4 and 5 only

    D.

    All of the above

    E.

    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Which of the following is the Object Oriented way of handling run-time errors?

  18. A.
    OnError
    B.
    HERESULT
    C.
    Exceptions
    D.
    Error codes
    E.
    Setjump and Longjump

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. 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 FreshergateConsoleApplication
    {
      class MyProgram
      {
      static void Main(string[] args)
    {
      int index;
      int val = 44;
      int[] a = new int[5];
      try
      {
         Console.Write("Enter a number:");
         index = Convert.Tolnt32(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");
        }
      }
    }

  20. A.

    It will output: Index out of bounds Remaining program

    B.

    It will output: Bad Format Remaining program

    C.

    It will output: Bad Format

    D.

    It will output: Remaining program

    E.

    It will output: Index out of bounds

    View Answer

    Workspace

    Discuss Discuss in Forum