Home / MCQ Bank / Computer
Computer Array Difficulty: Medium

What is the output of the following code? public class Test{ public static void main(String args[]){ double[] myList = {1, 5, 5, 5, 5, 1}; double max = myList[0]; int indexOfMax = 0; for(int i = 1; i < myList.length; i++){ if(myList[i] > max){ max = myList[i]; indexOfMax = i; } } System.out.println(indexOfMax); } }

Select the correct option to test your answer:

More Computer Questions

A flat-bed plotter uses a pen which moves in two directions across a piece of paper fixed on a flat-bed. Can you tell who controls the movements of this pen? What is the term for the use of AI-driven algorithms to analyze and optimize the allocation of healthcare resources and treatments? What will be the output of the following Python code? def change(i = 1, j = 2): i = i + j j = j + 1 print(i, j) change(j = 1, i = 2) Which is the type of port? The principle of locality of reference justifies the use of