Ask Question

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

+4
Answers (1)
  1. 1 March, 07:44
    0
    The correct option to this code is "a".

    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What would be the results of the following code? final int SIZE = 25; int[] array1 = new int[SIZE]; ... / / Code that will put values in ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers