Vidyalelo
C# Programming · Q91

Arrays and Strings in C Sharp

Programming · C# Programming · question 91

Q91

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();

A.
zx
B.
xy
C.
zy
Answer
D.
yz

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board