adplus-dvertising
frame-decoration

Question

Select the output for the following set of code :
class z
  {
      public int X;
      public int Y;
      public  const int c1 = 5;
      public  const int c2 = c1 * 25;
      public void set(int a, int b)
      {
          X = a;
          Y = b;
      }
 
  }
  class Program
  {
      static void Main(string[] args)
      {
          z s = new z();
          s.set(10, 20);
          Console.WriteLine(s.X + " " + s.Y);
          Console.WriteLine(z.c1 + " " + z.c2);
          Console.ReadLine();
      }
   }

a.

10 20
5 25

b.

20 10
25 5

c.

10 20
5 125

d.

20 10
125 5

Answer: (c).10 20
5 125

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Select the output for the following set of code :

Similar Questions

Discover Related MCQs

Q. Correct way of declaration of object of the following class is ?

class name

Q. The data members of a class by default are ?

Q. What does the following code imply ?

csharp abc;
abc = new charp();

Q. Which refrence modifier is used to define reference variable?

Q. Select the wrong statement about ‘ref’ keyword in C#?

Q. Select correct differences between ‘=’ and ‘==’ in C#.

Q. What is output for the following set of expression?

int a+= (float) b/= (long)c

Q. Which of following statements are correct about functions?

Q. When a function fun() is to receive an int, a single & a double and it is to return a decimal, then the correct way of defining this function is?

Q. How many values does a function return?

Q. Which return statement correctly returns the output:

Q. Number of constructors a class can define is ?

Q. Correct statement about constructors in C#.NET is ?

Q. Which among the following is the correct statement :
Constructors are used to

Q. Can the method add() be overloaded in the following ways in C#?

public int add() { }
public float add(){ }

Q. Which of the following statements is correct about constructors in C#.NET?

Q. What is the return type of constructors?

Q. Which method has the same name as that of its class?

Q. Which operator among the following signifies the destructor operator?

Q. The method called by clients of a class to explicitly release any resources like network,connection,open files etc.When the object is no longer required?