a) getBytes() b) GetByte() c) giveByte() d) Give Bytes() Answer: a Explanation: getBytes() stores the character in ...
View QuestionWhich of these methods of the class String is used to obtain length of String object?
a) get() b) Sizeof() c) lengthof() d) length() Answer: d Explanation: Method length() of string class is ...
View Question
What will be the output of the following C# code?
String a = “Csharp”;
String b = “CSHARP”;
int c;
c = a.CompareTo(b);
Console.WriteLine(c);
What will be the output of the following C# code? String a = "Csharp"; String b = "CSHARP";
View Question
What will be the output of the following C# code?
class Program
{
static void Main(string[] args)
{
String []chars = {“z”, “x”, “y”, “z”, “y”};
for (int i = 0; i < chars.Length; ++i)
for (int j = i + 1; j < chars.Length; ++j)
if(chars[i].CompareTo(chars[j]) == 0)
Console.WriteLine(chars[j]);
Console.ReadLine();
}
}
What will be the output of the following C# code? class Program { ...
View Question
What will be the output of the following C# code?
class Program
{
static void Main(string[] args)
{
String s1 = “I love You”;
String s2 = s1;
Console.WriteLine((s1 == s2) + ” ” + s1.Equals(s2));
Console.ReadLine();
}
}
What will be the output of the following C# code? class Program { static ...
View Question
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 { ...
View QuestionWhich of these data type values is returned by equals() method of String class?
a) char b) int c) boolean d) all of the mentioned Answer: c Explanation: equals() method of ...
View QuestionWhat is the value returned by function compareTo() if the invoking string is less than the string compared?
a) zero b) value less than zero c) value greater than zero d) none of the mentioned
View QuestionWhich of these methods returns the string such that some characters which are specified to be removed from the end of strings are removed from string by mentioning the number of characters to be removed?
a) Trim() b) Remove() c) TrimEnd() d) Split() Answer: a Explanation: Removes a string of characters ...
View QuestionWhich of these methods of class String is used to check whether a substring exists at the beginning of the particular string?
a) StartsWith() b) EndsWith() c) Starts() d) ends() Answer: a Explanation: Method startswith() of string class is ...
View Question