91.
What will be the output of the following C# code?
class Program
{
    static void Main(string[] args)
    { 
        String []chars = {"z", "x", "y", "z", "y"};
        for (int i = 0; i < chars.Length; ++i)
        for (int j = i + 1; j < chars.Length; ++j)
        if(chars[i].CompareTo(chars[j]) == 0)
        Console.WriteLine(chars[j]);
        Console.ReadLine();
    }
}

93.
What will be the output of the following C# code?
static void Main(string[] args)
{
    string s1 = "Hello" + " I " + "Love" + " ComputerScience ";
    Console.WriteLine(s1);
    Console.ReadLine();
}

95.
Complete the following C# code with "foreach condition".
int[][]a = new int[2][];
a[0] = new int[3]{3, 4, 2};
a[1] = new int[2]{8, 5};
foreach( int[]i in a)
{
/* add for loop */
console.write( j+ " ");
console.writeline();
}

96.
Statements about 'ref' keyword used in C#.NET are?

97.
Which of the following statement is correct about a string in C#.NET?

98.
What will be the output of the following C# code?
static void Main(string[] args)
{
    Program p = new Program();
    p.display(2, 3, 8);
    int []a = { 2, 56, 78, 66 };
    Console.WriteLine("example of array");
    Console.WriteLine("elements added are");
    p.display(a);
    Console.ReadLine();
}
public void display(params int[] b)
{
    foreach (int i in b)
    {
        Console.WriteLine("ARRAY IS HAVING:{0}", i);
    }
}

100.
What will be the output of the following C# code?
static void main(string[] args)
{
    int []arr = new int[]{ 1, 2, 3, 4, 5};
    fun (ref arr);
    for (int i = 0; i < arr.Length ; i++)
    Console.WriteLine( arr[i] + "  ");
}
static void fun(ref int[]a)
{
    a = new int[6];
    a[3] = 32;
    a[1] = 24;
}

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.