33.5k views
3 votes
Three students, studying the use of arrays, presented the

following statements.

I - The first student developed code 1 and concluded that his code makes use of

correct array and C ++ language.

#include <iostream>

using namespace std;

int main () {

int i, j, m [12] [12];

for (i = 0; i <12; i ++) {

for (j = 0; j <12; j ++) {

m [i] [j] = j% 2 - 1;

}

}

for (i = 0; i <12; i ++) {

for (j = 0; j <12; j ++) {

m [i] [j] = -1 - m [i] [j];

}

}

}

Code 1
II - The second student developed code 2 and concluded that his code does

correct use of arrays and the C ++ language.

#include <iostream>

using namespace std;

int main () {

double a [10] [5] = {{10}, {5}, {6}}, x [5] = {5}, b [10] = {1};

int i, j, m = 10, n = 5;

for (i = 0; i <m; i ++) {

b [i] = 10.0;

for (j = 0; j <n; j ++) {

b [i] = b [i] + a [i] [j] * x [j];

}

}

}

Code 2

III - The third student developed code 3 and concluded that his code makes use of

correct array and C ++ language. # include <iostream>

#include <iostream>

using namespace std;

const int N = 2;

int main () {

int i, j, k, a [N] [N] = {2,0,0,1}, b [N] [N] = {1,1,1,1}, c [N] [N] = {1,2,3,4};

for (i = 0; i <N; i ++) {

for (j = 0; j <N; j ++) {

c [i] [j] = 0;

for (k = 0; k <N; k ++) {

c [i] [j] + = a [i] [k] * b [k] [j];

}

}

}

}

Code 3
Check the correct alternative:

a) Only alternative I is true

b) Only alternative II is true

c) Alternatives I and II are true

d) Alternatives II and III are true

e) All statements are true​

User Shub
by
4.6k points

1 Answer

4 votes

Answer:

Sub to TeamS3P and I give u a cookie

Step-by-step explanation:

I think

User Cesar Morillas
by
4.8k points