Question 6: What will be the output of the following program?
public static void Main()
{
bool x=true, y=false;
if (x) if (y) Func1(); else Func2();
}
static void Func1() {
Console.Write("Func1");
}
static void Func2() {
Console.Write("Func2");
}
Question 7: What will be the output of the following program?
public static void Main()
{
int i =1;
switch (i) {
case 0:
while (true) Func1();
case 1:
throw new ArgumentException();
case 2:
return;
}
}
static void Func1() {
Console.Write("Func1");
}
Question 8: What will be the output of the following program?
int a=4, b=6;
switch (a)
{
case 4:
Console.WriteLine ("case 4");
break;
case "10":
Console.WriteLine ("case 10");
break;
}
Question 9: What will be the output of the following program?
int a=4, b=6;
switch (a+b/2)
{
case 4:
Console.WriteLine ("case 4");
break;
case 5:
Console.WriteLine ("case 5");
break;
case 7:
Console.WriteLine ("case 7");
break;
case 10:
Console.WriteLine ("case 10");
break;
}
Question 10: What will be the output of the following program?:
int a=4, b=6;
switch (a*b)
{
case a:
Console.WriteLine ("case a");
break;
case a*b:
Console.WriteLine ("case a*b");
break;
case b:
Console.WriteLine ("case b");
break;
}