Question: What output is produced by the following code? int i; int [ ] anArray = new int [5]; for (i = 0; i < anArray.Length;

What output is produced by the following code?

int i;

int [ ] anArray = new int [5];

for (i = 0; i < anArray.Length; i++)

anArray [i] = 2 * i;

for (i = 0; i < anArray.Length; i++)

Console.Write(anArray [i] + " ");

a. 2 2 2 2 2

b. 2 4 6 8 10

c. 0 2 4 6 8 10

d. 0 2 4 6 8

e. none of the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Systems Analysis Design Questions!