Arrays And Strings In C Sharp - Study Mode

[#126] Select the correct match of parameter declaration. static Void main(string[] args)
{
int a = 5
int b = 6
float c = 7.2f
math (ref a, ref b, ref c)
Console.WriteLine(a + " " + b + " " + c)
}
static int math(/*add parameter declaration */)
{
a += b
b *= (int)c
c += a * b
return 0
}
Correct Answer

(D) ref int a, ref int b, ref float c

[#127] What will be the output of the following C# code? static void Main(string[] args)
{
int[] x = { 80, 82, 65, 72, 83, 67 }
fun(x)
Console.ReadLine()
}
static void fun(params int [] b )
{
int i
for (i = 5
i >=0
i--)
{
Console.WriteLine(Convert.ToChar(b[i]))
}
}
Correct Answer

(C) C S H A R P

[#128] What will be the output of the following C# code snippet? static void Main(string[] args)
{
string c = "hello"
string c1 = c.Remove(1)
Console.WriteLine(c1)
Console.ReadLine()
}
Correct Answer

(B) h

[#129] Which method does following C# code explains? static void Main(string[] args)
{
int a = 10, b = 20
method(ref a, ref b)
console.writeline(a + " " + b)
}
static void swap(ref int i, ref int j)
{
int t
t = i
i = j
j = t
}
Correct Answer

(A) Call by reference

[#130] What will be the output of the following C# code? static void Main(string[] args)
{
int [] a = {1, 2, 3, 4, 5}
fun(a)
Console.ReadLine()
}
static void fun(params int[] b )
{
for (int i = 0
i < b.Length
i++)
{
b[i] = b[i] * 5
Console.WriteLine(b[i] + "")
}
}
Correct Answer

(B) 5, 10, 15, 20, 25