Miscellaneous In C Sharp - Study Mode

[#151] What will be the output of the following C# code snippet? class UnsafeCode
{
unsafe static void Main()
{
int* a
int a1 = 10
int b1
b1 = *&a1
a = &b1
{
Console.WriteLine(*a)
Console.ReadLine()
}
}
}
Correct Answer

(C) program will print value of a1

[#152] What will be the output of the following C# code snippet? class Program
{
static void Main(string[] args)
{
char []chars = {'a', 'b', 'c'}
String s = new String(chars)
Console.WriteLine(s)
Console.ReadLine()
}
}
Correct Answer

(D) abc

[#153] If ListBox is the class of System.Windows.Forms namespace. Then, the correct way to create an object of ListBox class is?
Correct Answer

(D) All of the mentioned

[#154] What will be the output of the following C# code snippet? unsafe static void Main()
{
int a = 5
int b = 5
int c = 5
int*[] ptr = new int* [3]
ptr[0] = &a
ptr[1] = &b
ptr[2] = &c
for (a = 0
a < 3
a++)
{
c += *ptr[a]
Console.WriteLine(c)
}
Console.ReadLine()
}
Correct Answer

(D) 5 10 20

[#155] What will be the output of the following C# code snippet? static void Main(string[] args)
{
string s1 = "Hello" + "c" + "Sharp"
Console.WriteLine(s1)
Console.ReadLine()
}
Correct Answer

(A) Hello c Sharp