21. What is the String in C# meant for?
22. Which of these operators can be used to concatenate two or more String objects?
23. Which of these is used as a default specifier for a member of the class if no access specifier is used for it?
24. What will be the output of the following C# code?
static void Main(string[] args)
{
string s1 = " Cshr ";
string s2 = s1.Insert(3 , " a ");
string s3 = s2.Insert(5 , " p ");
for (int i = 0;i < s3.Length; i++)
Console.WriteLine(s3[i]);
Console.ReadLine();
}
static void Main(string[] args)
{
string s1 = " Cshr ";
string s2 = s1.Insert(3 , " a ");
string s3 = s2.Insert(5 , " p ");
for (int i = 0;i < s3.Length; i++)
Console.WriteLine(s3[i]);
Console.ReadLine();
}
25. What will be the output of the following C# code?
static void Main(string[] args)
{
string s1 = "Hello I Love Csharp ";
Console.WriteLine(Convert.ToChar( (s1.IndexOf('I') - s1.IndexOf('l')) * s1.IndexOf('p'));
Console.ReadLine();
}
static void Main(string[] args)
{
string s1 = "Hello I Love Csharp ";
Console.WriteLine(Convert.ToChar( (s1.IndexOf('I') - s1.IndexOf('l')) * s1.IndexOf('p'));
Console.ReadLine();
}
26. The method in which large or variable number of arguments are handled is known as . . . . . . . .
27. Which among the following is the correct way to find out the index of second 's' in the string "She sold her beauty in one night to someone else"?
28. What will be the output of the following C# code?
static void Main(string[] args)
{
string s1 = "Hello";
string s2 = "hello";
if (s1 == s2)
Console.WriteLine("Equal");
else
Console.WriteLine("Unequal");
if (s1.Equals (s2))
Console.WriteLine("Equal");
else
Console.WriteLine("Unequal");
Console.ReadLine();
}
static void Main(string[] args)
{
string s1 = "Hello";
string s2 = "hello";
if (s1 == s2)
Console.WriteLine("Equal");
else
Console.WriteLine("Unequal");
if (s1.Equals (s2))
Console.WriteLine("Equal");
else
Console.WriteLine("Unequal");
Console.ReadLine();
}
29. What will be the output of the following C# code snippet?
static void main(String args[])
{
char chars[] = {'x', 'y', 'z'};
String s = new String(chars);
Console.WriteLine(s);
}
static void main(String args[])
{
char chars[] = {'x', 'y', 'z'};
String s = new String(chars);
Console.WriteLine(s);
}
30. Choose the statements which are false in nature?
Read More Section(Arrays and Strings in C Sharp)
Each Section contains maximum 100 MCQs question on Arrays and Strings in C Sharp. To get more questions visit other sections.