- Online Exam Test Papers | - MCQs[multiple choice questions and answers ] | - Mock Test Papers | - Practice Papers | - Sample Test Papers |

Question:
Which of the following statements is correct about the C#.NET program given below if a value "ABCD" is input to it?

using System;
namespace IndiabixConsoleApplication
{
    class MyProgram
    {
        static void Main(string[] args)
        {
            int index; 
            int val = 55; 
            int[] a = new int[5]; 
            try
            {
                Console.Write("Enter a number: ");
                index = Convert.ToInt32(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 ");
        }
    }
}

1.It will output: Bad Format

2.It will output: Remaining program

3.It will output: Index out of bounds

4. It will output: Bad Format Remaining program

Posted Date:-2021-02-25 10:08:49


More MCQS Questions and answers

Search