Vidyalelo
C# Programming · Q95

Arrays and Strings in C Sharp

Programming · C# Programming · question 95

Q95

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

A.
foreach (int j = 1;(j(<)(a(0).GetUpperBound)); (j++));
B.
foreach (int j = 1;(j(<)(a.GetUpperBound(0))); (j++));
C.
foreach (int j in a.Length);
D.
foreach (int j in i);
Answer

Answer: Option D

Solution

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