Exercise: Python

Questions for: Exception Handling

Which of the following statements is correct about the C#.NET program given below?
using System;
namespace ExamAdept
{
    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");
        }
    }
}
A:
Value 44 will get assigned to a[6].
B:
It will output: Index out of bounds
C:
It will output: Remaining program
D:
It will not produce any output.
Answer: E
No answer description is available. Let's discuss.
In C#.NET if we do not catch the exception thrown at runtime then which of the following will catch it?
A:
Compiler
B:
CLR
C:
Linker
D:
Loader
Answer: B
No answer description is available. Let's discuss.
Which of the following statements is correct about an Exception?
A:
It occurs during compilation.
B:
It occurs during linking.
C:
It occurs at run-time.
D:
It occurs during Just-In-Time compilation.
Answer: C
No answer description is available. Let's discuss.
Which of the following is NOT a .NET Exception class?
A:
Exception
B:
StackMemoryException
C:
DivideByZeroException
D:
OutOfMemoryException
Answer: B
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz