Top-Down Development

Practice Questions

Computer Science › Top-Down Development

Questions
1
1

Consider the following code:

int\[\] vals = {6,1,41,5,1};

int\[\]\[\] newVals = new int\[vals.length\]\[\];

for(int i = 0; i < vals.length; i++) {

newVals\[i\] = new int\[vals\[i\]\];

for(int j = 0; j < vals\[i\];j++) {

newVals\[i\]\[j\] = vals\[i\] * (j+1);

}

}

What does the code above do?

Return to subject