51. What will be the output of the following C# code?
class Output
{
public static void main(String args[])
{
try
{
int a = 10;
int b = 5;
int c = a / b - 5;
Console.WriteLine("Hi");
}
catch(Exception e)
{
Console.WriteLine("hello");
}
}
}
class Output
{
public static void main(String args[])
{
try
{
int a = 10;
int b = 5;
int c = a / b - 5;
Console.WriteLine("Hi");
}
catch(Exception e)
{
Console.WriteLine("hello");
}
}
}
52. Choose the wrong statement about the properties used in C#.NET?
53. Which of these keywords is not a part of exception handling?
54. Which of the following is the object oriented way to handle run time errors?
55. What will be the output of the following C# code snippet?
class program
{
public static void Main(string[] args)
{
try
{
throw new NullReferenceException("C");
Console.WriteLine("A");
}
catch (ArithmeticException e)
{
Console.WriteLine("B");
}
Console.ReadLine();
}
}
class program
{
public static void Main(string[] args)
{
try
{
throw new NullReferenceException("C");
Console.WriteLine("A");
}
catch (ArithmeticException e)
{
Console.WriteLine("B");
}
Console.ReadLine();
}
}
56. 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 = 1 / a;
Console.WriteLine(a);
}
catch (ArithmeticException e)
{
Console.WriteLine("1");
}
Console.ReadLine();
}
}
class program
{
public static void Main(string[] args)
{
try
{
int a = args.Length;
int b = 1 / a;
Console.WriteLine(a);
}
catch (ArithmeticException e)
{
Console.WriteLine("1");
}
Console.ReadLine();
}
}
57. What will be the output of the following C# code?
class Output
{
public static void main(String args[])
{
try
{
int a = 5;
int b = 10;
int c = b / a - 5;
Console.WriteLine("Csharp");
}
}
}
class Output
{
public static void main(String args[])
{
try
{
int a = 5;
int b = 10;
int c = b / a - 5;
Console.WriteLine("Csharp");
}
}
}
58. Choose the correct statement among the following?
59. Which of these keywords are used for generating an exception manually?
60. Choose the keyword which declares the indexer?
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.