Sail E0 Webinar
Question
What would be output for the set of code?
class maths {     public int x;     public double y;     public int add(int a, int b)     {         x = a + b;         return x;     }     public int add(double c, double d)     {         y = c + d;         return (int)y;     }     public maths()     {         this.x = 0;         this.y = 0;     } }    class Program{    static void Main(string[] args)    {        maths obj = new maths();        int a = 4;        double b = 3.5;        obj.add(a, a);        obj.add(b, b);        Console.WriteLine(obj.x + " " + obj.y);        Console.ReadLine();    }}
Options:
A .  4, 3.5
B .  8, 0
C .  7.5, 8
D .  8, 7
Answer: Option D





Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers