adplus-dvertising
frame-decoration

Question

What will be the output of the given code snippet?
interface calc
 {
     void cal(int i);
 }
 public  class maths :calc 
 {
     public int x;
     public void cal(int i) 
     {
         x = i * i;            
     }
 }
 class Program
 {
     public static void Main(string[] args)
     {            
         display arr = new display();
         arr.x = 0;      
         arr.cal(2);
         Console.WriteLine(arr.x);
         Console.ReadLine();
     }
 }

a.

0

b.

2

c.

4

d.

None of the mentioned

Posted under C# programming

Answer: (c).4

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the given code snippet?