csharp Structure Questions & Answers

Question 1: Which of the following statement is correct bout the structure (struct)?

Question 2: What will be the output of the following program?

public static void Main(string[] args)
{
	Point p;
	p.x=10;
	Console.Write( p.x);
}

struct Point
{
	private int _x;
	public int x{
        get 
        {
            return _x;
        }

        set 
        {
            _x = value;
        }
    }
}

Question 3: What will be the output of the following program?

public static void Main(string[] args)
{
	Point p;
	Console.Write( p.x);
}

		
struct Point
{
	public int x;
}
ADVERTISEMENT

Question 4: What will be the output of the following program?

public static void Main(string[] args)
{
	Point p = new Point(10);
	Console.Write( p.X);
}
		
struct Point
{
	public int X;
	public Point(int x)
    {
        X=x;
    }
}