csharp Variable Questions & Answers

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

public class Program
{
	public static void Main()
	{
		Employee emp = new Employee();
		Console.WriteLine(emp.salary); 
	}
}

public class Employee
{
	public int salary;
}

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

public class Program
{
	public static void Main()
	{
		int[] arr = new int[5];
		Console.WriteLine(arr[0]); 
	}
}

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

public static void Main()
{
	int k;
	display(k);
}
	
static void display(int val)
{
	Console.Write(val);
}

Question 9: Which of the following keyword is used to declare a variable whose type will be automatically determined by the compiler?

Question 10: Which of the following type escapes type checking at compile-time; instead, it resolves type at run time?