51. What will be the output of the following C# code?
static void Main(string[] args)
{
String a = "Ilove";
String b = "CSHARP";
b = string.Concat(a, ' ', b);
Console.WriteLine(b);
Console.ReadLine();
}
static void Main(string[] args)
{
String a = "Ilove";
String b = "CSHARP";
b = string.Concat(a, ' ', b);
Console.WriteLine(b);
Console.ReadLine();
}
52. What will be the output of the following C# code?
static void Main(string[] args)
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
string s = obj+" "+obj1;
Console.WriteLine(s.IndexOf('r'));
Console.ReadLine();
}
static void Main(string[] args)
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
string s = obj+" "+obj1;
Console.WriteLine(s.IndexOf('r'));
Console.ReadLine();
}
53. What does the term 'immutable' means in term of string objects?
54. Accessibility modifier defined in a class are?
55. Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?
56. What will be the output of the following C# code?
static void main(string[] args)
{
int i;
int res = fun (out i);
console.writeline(res);
console.readline();
}
static int fun(out int i)
{
int s = 1;
i = 7;
for (int j = 1; j <= i; j++ )
s = s * j;
return s;
}
static void main(string[] args)
{
int i;
int res = fun (out i);
console.writeline(res);
console.readline();
}
static int fun(out int i)
{
int s = 1;
i = 7;
for (int j = 1; j <= i; j++ )
s = s * j;
return s;
}
57. What will be the output of the following C# code?
static void Main(string[] args)
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
string s = obj + " " + obj1;
Console.WriteLine(s.Substring(6 ,5));
Console.ReadLine();
}
static void Main(string[] args)
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
string s = obj + " " + obj1;
Console.WriteLine(s.Substring(6 ,5));
Console.ReadLine();
}
58. What will be the output of the following C# code?
static void Main(string[] args)
{
int i, j;
int[, ] arr = new int[ 3, 3];
for (i = 0; i < 3; ++i)
{
for (j = 0; j < 3; ++j)
{
arr[i, j] = i * 2 + i * 2;
Console.WriteLine(arr[i, j]);
}
Console.ReadLine();
}
}
static void Main(string[] args)
{
int i, j;
int[, ] arr = new int[ 3, 3];
for (i = 0; i < 3; ++i)
{
for (j = 0; j < 3; ++j)
{
arr[i, j] = i * 2 + i * 2;
Console.WriteLine(arr[i, j]);
}
Console.ReadLine();
}
}
59. The modifiers used to define an array of parameters or list of arguments is . . . . . . . .
60. What will be the output of the following C# code?
static void Main(string[] args)
{
object[] a = {" 1 ", 4.0f, " harsh "};
fun(a);
Console.ReadLine();
}
static void fun(params object[] b)
{
for (int i = 0; i < b.Length - 1; i++)
Console.WriteLine(b[i] + " ");
}
static void Main(string[] args)
{
object[] a = {" 1 ", 4.0f, " harsh "};
fun(a);
Console.ReadLine();
}
static void fun(params object[] b)
{
for (int i = 0; i < b.Length - 1; i++)
Console.WriteLine(b[i] + " ");
}
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.