Question
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();
}
a.
Compile time error
b.
Run time error
c.
B 0
d.
B
Posted under C# programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What would be the output of given code snippet?
Similar Questions
Discover Related MCQs
Q. Choose the correct statement which makes exception handling work in C#.NET?
View solution
Q. Which of these clauses will be executed even if no exceptions are found?
View solution
Q. A single try block must be followed by which of these?
View solution
Q. Which of these exceptions handles the divide by zero error?
View solution
Q. Which of these exceptions will occur if we try to access the index of an array beyond its length?
View solution
Q. Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?
View solution
Q. Which of these classes is related to all the exceptions that are explicitly thrown?
View solution
Q. What is the use of try & catch?
View solution
Q. Choose the statement which is incorrect?
View solution
Q. Which of the keywords are used for the block to be examined for exceptions?
View solution
Q. Which of these keywords are used for the block to handle the exceptions generated by try block?
View solution
Q. Which of these keywords are used for generating an exception manually?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!