61. 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;
}
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;
}
62. 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]));
}
}
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]));
}
}
63. 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();
}
static void Main(string[] args)
{
string c = "hello";
string c1 = c.Remove(1);
Console.WriteLine(c1);
Console.ReadLine();
}
64. 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;
}
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;
}
65. 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] + "");
}
}
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] + "");
}
}
66. Which of these data type values is returned by equals() method of String class?
67. Which statement is correct about following C# code?
int[, ]a={{5, 4, 3},{9, 2, 6}};
int[, ]a={{5, 4, 3},{9, 2, 6}};
68. What will be the output of the following C# code?
class Program
{
static void Main(string[] args)
{
String s1 = "I love You";
String s2 = s1;
Console.WriteLine((s1 == s2) + " " + s1.Equals(s2));
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
String s1 = "I love You";
String s2 = s1;
Console.WriteLine((s1 == s2) + " " + s1.Equals(s2));
Console.ReadLine();
}
}
69. Correct way to convert a string to uppercase using string class method()?
70. What will be the output of the following C# code?
static void Main(string[] args)
{
string s = " i love you";
Console.WriteLine(s.IndexOf('l') + " " + s.lastIndexOf('o') + " " + s.IndexOf('e'));
Console.ReadLine();
}
static void Main(string[] args)
{
string s = " i love you";
Console.WriteLine(s.IndexOf('l') + " " + s.lastIndexOf('o') + " " + s.IndexOf('e'));
Console.ReadLine();
}
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.