91. Choose the operator/operators which is/are not used to access the [] operator in indexers?
92. Choose the correct statement which makes exception handling work in C#.NET?
93. Choose the statement which is incorrect?
94. Which among the following is NOT an exception?
95. What is the use of try & catch?
96. Which of these keywords is used to manually throw an exception?
97. Choose the correct option among the following indexers which correctly allows to index in same way as an array?
98. What will be the output of the following C# code?
class number
{
int length = 50;
public int number1
{
get
{
return length;
}
set
{
length = value;
}
}
}
class Program
{
public static void Main(string[] args)
{
number p = new number();
p.number1 = p.number1 + 40;
int k = p.number1 * 3 / 9;
Console.WriteLine(k);
Console.ReadLine();
}
}
class number
{
int length = 50;
public int number1
{
get
{
return length;
}
set
{
length = value;
}
}
}
class Program
{
public static void Main(string[] args)
{
number p = new number();
p.number1 = p.number1 + 40;
int k = p.number1 * 3 / 9;
Console.WriteLine(k);
Console.ReadLine();
}
}
99. What will be the output of the following C# code snippet?
class Program
{
public static void Main(string[] args)
{
try
{
int a = args.Length;
int b = 10 / a;
Console.WriteLine(a);
try
{
if (a == 1)
a = a / a - a;
if (a == 2)
{
int[] c = { 1 };
c[8] = 9;
}
}
catch (IndexOutOfRangeException e)
{
Console.WriteLine("TypeA");
}
}
catch (ArithmeticException e)
{
Console.WriteLine("TypeB");
}
Console.ReadLine();
}
}
class Program
{
public static void Main(string[] args)
{
try
{
int a = args.Length;
int b = 10 / a;
Console.WriteLine(a);
try
{
if (a == 1)
a = a / a - a;
if (a == 2)
{
int[] c = { 1 };
c[8] = 9;
}
}
catch (IndexOutOfRangeException e)
{
Console.WriteLine("TypeA");
}
}
catch (ArithmeticException e)
{
Console.WriteLine("TypeB");
}
Console.ReadLine();
}
}
100. Which of these classes is related to all the exceptions that are explicitly thrown?
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.