What is the output of the following code fragment?

int array[4][4], index1, index2;
for(index1=0;index1<4;index1++)
for(index2=0;index2<4;index2++)
array[index1][index2]=index1 + index2;
for(index1=0;index1<4;index1++)
{
for(index2=0;index2<4;index2++)
cout << array[index1][index2] << " ";
cout << endl;
}
a. 0 1 2 3
1 2 3 4
2 3 4 5
3 4 5 6
b. 0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
c. 0 0 0 0
1 1 1 1
2 2 2 2
3 3 3 3
d. 0 0 0 0
0 1 2 3
0 2 4 6
0 3 6 9

a. 0 1 2 3
1 2 3 4
2 3 4 5
3 4 5 6

Computer Science & Information Technology

You might also like to view...

Released in 1984, the Apple Macintosh was the first computer that used 3.5-inch floppy disks

Indicate whether the statement is true or false

Computer Science & Information Technology

In the absence of braces in an if-else statement, each else is associated with the ____ unpaired if.

A. next B. last C. shortest D. closest

Computer Science & Information Technology