Home / C# Programming / Exception Handling :: Discussion

Discussion :: Exception Handling

  1. Which of the following statements is correct about the C#.NET program given below?

     using System;
     namespace FreshergateConsoleApplication 
     {  
        class MyProgram    
     {         
         static void Main(string[] args)        
         {            
             int index = 6;        
             int val = 44;           
             int[] a = new int[5];           
             try        
             {
    
                a [index] = val ;          
             }           
             catch(IndexOutOfRangeException e)       
             {           
                 Console.Write("Index out of bounds ");       
             }         
              Console.Write("Remaining program");      
         }    
      } 
    }
    

  2. A.

    Value 44 will get assigned to a[6].

    B.

    It will output: Index out of bounds

    C.

    It will output: Remaining program

    D.

    It will not produce any output.

    E.

    It will output: Index out of bounds Remaining program

    View Answer

    Workspace

    Answer : Option E

    Explanation :

    No answer description available for this question.


Be The First To Comment