Are you interested in government and politics, or is it a subject you don’t think about too much? (A sentence or two is fine)
Are you interested in government and politics, or is it a su…
Given the declaration below, what does scores[1] refer to?in…
Given the declaration below, what does scores[1] refer to?int[][] scores = { {90, 85, 78}, {70, 92, 88} };
In a grade table, total and count are int variables holding…
In a grade table, total and count are int variables holding one row’s sum and its number of scores. Which expression gives the exact decimal average, such as 86.33 rather than 86?
What is printed by the following code?ArrayList line = new A…
What is printed by the following code?ArrayList line = new ArrayList(); line.add(“Ava”); line.add(“Ben”); line.set(0, “Cy”); line.add(0, “Dee”); System.out.println(line.get(1) + ” ” + line.size());
What is printed by the following code?int total = 0; for (in…
What is printed by the following code?int total = 0; for (int i = 1; i
What is printed by the following code?int n = 100; for (int…
What is printed by the following code?int n = 100; for (int i = 1; i
What does this code print?public static int findIndex(int[]…
What does this code print?public static int findIndex(int[] arr, int target) { for (int i = 0; i < arr.length; i++) { if (arr[i] == target) { return i; } } return -1; } // in main: int[] codes = {4, 7, 2, 7, 9}; System.out.println(findIndex(codes, 7) + " " + findIndex(codes, 5));
What is printed by the following code?int[][] grid = new int…
What is printed by the following code?int[][] grid = new int[2][4]; int counter = 10; for (int row = 0; row < grid.length; row++) { for (int col = 0; col < grid[row].length; col++) { grid[row][col] = counter; counter += 5; } } System.out.println(grid[1][2]);
What is printed by the following code?String first = “Mina”;…
What is printed by the following code?String first = “Mina”; String last = “Torres”; System.out.println(first + last + “!”);
a and b are String variables. Which statement correctly desc…
a and b are String variables. Which statement correctly describes what a == b and a.equals(b) compare?