Examveda

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: Option D


Join The Discussion

Related Questions on Arrays and Strings in C Sharp