Question 21: What will be the output of the following program?
public static void Main(string[] args)
{
object o = "Bill";
Console.WriteLine(o.GetType());
}
Question 22: What will be the output of the following program?
public static void Main(string[] args)
{
object o = "Bill";
Change(o);
}
static void Change(object obj)
{
Console.Write("object");
}
static void Change(string str)
{
Console.Write("string");
}
Question 23: What will be the output of the following program?
public static void Main(string[] args)
{
int i=10;
float f = 34.412F;
display(i);
display(f);
}
static void display(float f){
Console.Write(f + " ");
}
Question 24: What will be the output of the following program?
public static void Main(string[] args)
{
int i=10;
float f = 34.412F;
display(i);
display(f);
}
static void display(int i){
Console.Write(i + " ");
}
Question 25: Which of the following convert a string to an int?
Question 26: What will be the output of the following program?
public class Program
{
public static void Main(string[] args)
{
for(int i=0;i<4;i++)
Printer.Print(i);
}
}
public class Printer
{
public static void Print(object o)
{
Console.Write(o);
}
}
Question 27: What will be the output of the following program?
object o = "Hello"
string s1 = o;
Console.Write(s1);
Question 28: What will be the output of the following program?
static void Main()
{
object obj = "Hello";
Console.Write(obj is string);
}
Question 29: String is _______ .
Question 30: What will be the output of the following program?
public static void Main()
{
StringBuilder sb = new StringBuilder();
sb = "Hello";
Console.WriteLine(sb);
}