Arrays And Strings In C Sharp - Study Mode

[#71] What will be the output of the following C# code? static void Main(string[] args)
{
String obj = "hello"

String obj1 = "world"

String obj2 = obj

Console.WriteLine(obj + " " + obj1)

string s = obj + " " + obj1

Console.WriteLine(s.Length)

Console.ReadLine()

}
Correct Answer

(C) hello world 11

[#72] What will be the output of the following C# code? static void Main(string[] args)
{
String obj = "hello"

String obj1 = "world"

String obj2 = obj

Console.WriteLine (obj.Equals(obj2) + " " + obj2.CompareTo(obj) )

Console.ReadLine()

}
Correct Answer

(C) True 0

[#73] Choose the effective stringBuilder method which helps in producing output for the following C# code? static void Main(string[] args)
{
StringBuilder s = new StringBuilder("object")

s./*______*/("Oriented Language")

Console.WriteLine(s)

Console.ReadLine()

}
Output : objectOriented Language
Correct Answer

(C) Append()

[#74] What will be the output of the following C# code? static void Main(string[] args)
{
int[] x = {65, 66, 67, 68, 69, 70}

fun(x)

Console.ReadLine()

}
static void fun(params int[] b )
{
int i

for (i = 5

i > 0

i--)
{
b[i] = b[i] + 32

Console.WriteLine(Convert.ToChar(b[i]))

}
}
Correct Answer

(C) f, e, d, c, b

[#75] 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)

string d = b.TrimStart('I', 'l', 'o', 'H')

Console.WriteLine(d)

Console.ReadLine()

}
Correct Answer

(C) ve CSHARP