Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C# code?
static void Main(string[] args)
{
char c = ‘g’;
string s = c.ToString();
string s1 = “I am a human being” + c;
Console.WriteLine(s1);
Console.ReadLine();
}

What will be the output of the following C# code?
static void Main(string[] args)
{
char c = ‘g’;
string s = c.ToString();
string s1 = “I am a human being” + c;
Console.WriteLine(s1);
Console.ReadLine();
}
a) I am a human bein c
b) I am a human being
c) I am a human being c
d) I am a human bein

Answer: b
Explanation: ‘g’is stored in character variable ‘c’ which later on is converted to string using method Convert.Tostring() and hence appended at last of the string in s1.

Join The Discussion