Question: What will be the output of the following code: using System; class MyProgram { static void Main ( string [ ] args ) { int

What will be the output of the following code:
using System;
class MyProgram
{
static void Main(string[] args)
{
int index =10;
int[] arr = new int[9];
try
{
arr[index]=100;
}
catch(IndexOutOfRangeException e)
{
Console.WriteLine("ERROR: Index out of bounds occurred");
}
Console.WriteLine("Program continues executing after Exception Handling");
}
}
Group of answer choices
Outputs: Index out of bounds occurred
assigns 100 to arr[10]
Program continues executing after Exception Handling
Outputs: ERROR: Index out of bounds occurred
Outputs: ERROR: Index out of bounds occurred
Program continues executing after Exception Handling
Outputs: Program continues executing after Exception Handling
Runtime error occurs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!