Home / C# Programming / Structures :: Discussion

Discussion :: Structures

  1. Which of the following will be the correct output for the C#.NET program given below?

      namespace FreshergateConsoleApplication
      {    
           struct Sample  
           {        
                public int i;    
           }  
           class MyProgram   
           {      
               static void Main()     
               {         
                   Sample x = new Sample();              
                   x.i = 10;    
                   fun(x);              
                   Console.Write(x.i + " ");     
                }       
                static void fun(Sample y)  
                {         
                      y.i = 20;              
                      Console.Write(y.i + " ");           
                }   
            } 
        }
    

     

     

  2. A.

    10 20

    B.

    10 10

    C.

    20 10

    D.

    20 20

    E.

    None of the above

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment