Home / C# Programming / Exception Handling :: Discussion

Discussion :: Exception Handling

  1. 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 = 66;         
                 int[] a = new int[5];       
                 try        
                 {        
                      Consote.Write("Enter a number: ");    
                      index = Convert.ToInt32(Console.ReadLine());                            
                      a [ index] = val;      
                 }        
                 catch(Exception e)       
                {           
                    Console.Write("Exception occurred ");        
                }          
                Console.Write("Remaining program ");       
            }     
        }
     }
    

     

     

  2. A.

    It will output: Exception occurred

    B.

    It will output: Remaining program

    C.

    It will output: Exception occurred Remaining program

    D.

    It will output: Remaining program Exception occurred

    E.

    The value 66 will get assigned to a[6].

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment