81. A single try block must be followed by which of these?
82. Choose the correct statement about properties describing the indexers?
83. Which of these exceptions handles the divide by zero error?
84. Choose the correct statements about write-only properties in C#.NET?
85. Select the correct statement about an Exception?
86. What will be the output of the following C# code?
class Output
{
public static void main(String args[])
{
try
{
int a = 9;
int b = 5;
int c = a / b - 5;
Console.WriteLine("Hello");
}
catch(Exception e)
{
Console.WriteLine("C");
}
finally
{
Console.WriteLine("sharp");
}
}
}
class Output
{
public static void main(String args[])
{
try
{
int a = 9;
int b = 5;
int c = a / b - 5;
Console.WriteLine("Hello");
}
catch(Exception e)
{
Console.WriteLine("C");
}
finally
{
Console.WriteLine("sharp");
}
}
}
87. When is no exception thrown at runtime then who will catch it?
88. Which among the following is considered as .NET Exception class?
89. What will be the output of the following C# code?
public static void Main(string[] args)
{
try
{
int a, b, c = 5;
b = 0;
a = c / b;
Console.WriteLine("A");
}
catch (ArithmeticException e)
{
int c = 5;
int i = 10;
int z = 2 * c - i;
Console.WriteLine("B");
Console.WriteLine(z);
}
Console.ReadLine();
}
public static void Main(string[] args)
{
try
{
int a, b, c = 5;
b = 0;
a = c / b;
Console.WriteLine("A");
}
catch (ArithmeticException e)
{
int c = 5;
int i = 10;
int z = 2 * c - i;
Console.WriteLine("B");
Console.WriteLine(z);
}
Console.ReadLine();
}
90. What will be the output of the following C# code?
static void Main(string[] args)
{
try
{
Console.WriteLine("csharp" + " " + 1/Convert.ToInt32(0));
}
catch(ArithmeticException e)
{
Console.WriteLine("Java");
}
Console.ReadLine();
}
static void Main(string[] args)
{
try
{
Console.WriteLine("csharp" + " " + 1/Convert.ToInt32(0));
}
catch(ArithmeticException e)
{
Console.WriteLine("Java");
}
Console.ReadLine();
}
Read More Section(Exception Handling in C Sharp)
Each Section contains maximum 100 MCQs question on Exception Handling in C Sharp. To get more questions visit other sections.