87.5k views
0 votes
What would be the results of the following code?final int SIZE = 25;int[] array1 = new int[SIZE];... // Code that will put values in array1int value = 0;for (int a = 0; a < array1.length; a++){value += array1[a];}a.value contains the highest value in array1b.value contains the lowest value in array1c.value contains the sum of all the values in array1d.This would cause the program to crash

User Share
by
7.7k points

1 Answer

0 votes

Answer:

The correct option to this code is "a".

Step-by-step explanation:

The given code contains the highest value in array1 because code will use variable value that adds all value of array1. and other options are not correct that can be described as:

  • In option, b The value variable, we add a number that's why it can not contain the lowest value.
  • In option, c The value variable use for loop for add all array element not sum of values.
  • In option, d There will no crash in program.
User Alexey Dolgopolov
by
6.9k points