gs gs108 Indexers and Exception Handling - Implementation of Exception Handling - Quiz No.1
gs gs108 CSharp Quiz
This quiz belongs to book/course code gs gs108 CSharp of gs organization. We have 110 quizzes available related to the book/course CSharp. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Indexers and Exception Handling. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
class Program { static void Main(string[] args) { int i; int v = 40; int[] x = new int[5]; try { Console.WriteLine(" Enter the number: "); index = Convert.ToInt32(Console.ReadLine()); x[index] = v; } catch(Exception e) { Console.WriteLine("Exception occurred"); } Console.WriteLine("Program executed"); } }
Exception occurred Program executed
Program executed Exception occurred
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(); }