Discussion :: Exception Handling
-
Which of the following statements is correct about the C#.NET program given below if a value "6" is input to it
using System;
namespace FreshergateConsoleApplication
{
class MyProgram
{
static void Main(string[] args)
{
int index;
int val = 44;
int[] a = new int[5];
try
{
Console.Write("Enter a number:");
index = Convert.Tolnt32(Console.ReadLine());
a[index] = val;
}
catch(FormatException e)}
Console.Write("Bad Format");
}
catch(IndexOutOfRangeException e)
{
Console.Write("Index out of bounds");
Console.Write("Remaining program");
}
}
}
A.
It will output: Index out of bounds Remaining program |
B.
It will output: Bad Format Remaining program |
C.
It will output: Bad Format |
D.
It will output: Remaining program |
E.
It will output: Index out of bounds |
Answer : Option A
Explanation :
No answer description available for this question.
Be The First To Comment