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)
{
string s1 = “Hello” + ” I ” + “Love” + ” ComputerScience “;
Console.WriteLine(s1);
Console.ReadLine();
}

What will be the output of the following C# code?
static void Main(string[] args)
{
string s1 = “Hello” + ” I ” + “Love” + ” ComputerScience “;
Console.WriteLine(s1);
Console.ReadLine();
}
a) HelloILoveComputerScience
b) Hello I Love ComputerScience
c) Compile time error
d) Hello

Answer: b
Explanation: Here ‘+’ defined operator works as concatenation for strings.
Output :
Hello I Love ComputerScience

Join The Discussion