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?
class Program
{
static void Main(string[] args)
{
String c = “i love Csharp”;
bool a;
a = c.StartsWith(“I”);
Console.WriteLine(a);
Console.ReadLine();
}
}

What will be the output of the following C# code?
class Program
{
static void Main(string[] args)
{
String c = “i love Csharp”;
bool a;
a = c.StartsWith(“I”);
Console.WriteLine(a);
Console.ReadLine();
}
}
a) true
b) false
c) 0
d) 1

Answer: b
Explanation: StartsWith() method is case sensitive “i” and “I” are treated differently, hence false is stored in a.
Output:
false

Join The Discussion