Arrays And Strings In C Sharp - Study Mode
[#116] How to print on the screen?
Correct Answer
(C) Console.WriteLine("\\")
[#117] What will be the output of the following C# code? static void Main(string[] args)
{
int a = 5
int b = 0, c = 0
method (a, ref b, ref c)
Console.WriteLine(b + " " + c)
Console.ReadLine()
}
static int method(int x, int p, ref int k)
{
p = x + x * x
k = x * x + p
return 0
}
Correct Answer
(C) Compile time error
[#118] 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()
}
Correct Answer
(D) Ilove CSHARP
[#119] 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()
}
Correct Answer
(B) 8
[#120] 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
}
Correct Answer
(B) 5040