adplus-dvertising
frame-decoration

Question

What will be the output of the given code snippet?
public class A
 {
     public int x;
     public int y;
     public void display() 
     {
         Console.WriteLine(x + " " + y);
     }
 }
 class Program
 {
     static void Main(string[] args)
     {
         A obj1 = new A();
         A obj2 = new A();
         obj1.x = 1;
         obj1.y = 2;
         obj2 = obj1;
         obj1.display();
         obj2.display();
     }
 }class Program
{
    static void Main(string[] args)
    {
        double x = 3.14;  
        int y = (int) Math.Abs(x);
        Console.WriteLine(y);
    }
}

a.

0

b.

3

c.

3.0

d.

3.1

Posted under C# programming

Answer: (b).3

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?

Similar Questions

Discover Related MCQs

Q. Which of the following functions return absolute value of a variable?

Q. Which of these methods return a largest whole number less than or equal to variable X?

Q. Which of these method returns a smallest whole number greater than or equal to variable X?

Q. Which of these methods is a rounding function of Math class?

Q. Which among the given classes provides types of rounding functions?

Q. What is the value of double constant ‘E’ defined in Math class?

Q. Which of these classes contains only floating point functions?

Q. The wrong statements about a HashTable collection are?

Q. In which of the following collections is the I/O based on a key?

Q. A HashTable t maintains a collection of names of states and capital city of each state.Which among the following finds out whether “New delhi” state is present in the collection or not?

Q. Which among the given statements are correct about the Stack collection?

Q. Among the given collections which one is I/O index based?

Q. Which statements among the following are correct about the Collection Classes available in Framework Class Library?

Q. Which is the correct statement about an ArrayList collection that implements the IEnumerable interface?

Q. Which among the following is the correct way to find out the number of elements currently present in an ArrayListCollection called arr?

Q. Which among the following is not an interface declared in System.Collection namespace?

Q. Which among the following is not the ordered collection class?

Q. Which of the following statements are correct about the Collection Classes available in Framework Class Library?

Q. Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr?

Q. Suppose value of the Capacity property of ArrayList Collection is set to 4. What will be the capacity of the Collection on adding fifth element to it?