Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following method, which is intended to return the number of columns in the two - dimensional array arr for which the sum of
Consider the following method, which is intended to return the number of columns in the twodimensional array arr for which the sum of the elements in the column is greater than the parameter val.
public int countColsint arr, int val
int count ;
for int col ; col arrlength; col Line
int sum ;
for int row : col Line
sum rowcol; Line
if sum val
count;
return count;
The countCols method does not work as intended. Which of the following changes should be made so the method works as intended?
Responses
Line
should be changed to for int col ; col arr.length; col
Line should be changed to for int col ; col arr.length; col
Line
should be changed to for int row : col
Line should be changed to for int row : col
Line
should be changed to for int row : arr
Line should be changed to for int row : arr
Line
should be changed to sum arrcol;
Line should be changed to sum arrcol;
Line
should be changed to sum arrrowcol;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started