Consider the following code segment. /* missing loop header…

Consider the following code segment. /* missing loop header */{ for (int k = 0; k < 4; k++) { System.out.print(k); } System.out.println();} The code segment is intended to produce the following output. 0123 0123 0123 Which of the following can be used to replace /* missing loop header */ so that the code segment works as intended? I. for (int j = 0; j < 3; j++)II. for (int j = 1; j < 3; j++)III. for (int j = 1; j

Consider the following method that is intended to determine…

Consider the following method that is intended to determine if the double values d1 and d2 are close enough to be considered equal. For example, given a tolerance of 0.001 , the values 54.32271 and 54.32294 would be considered equal. /** 0return true if d1 and d2 are within the specified tolerance, *false otherwisepublic Boolean almostEqual(double d1, double d2, double tolerance){ /* missing code */} Which of the following should replace / * missing code * / so that almostEqual will work as intended?

The following method is intended to print the number of digi…

The following method is intended to print the number of digits in the parameter num. public int numDigits(int num){ int count = 0; while (/* missing condition */) { count++; num = num / 10; } return count;} Which of the following can be used to replace / * missing condition */ so that the method will work as intended?

Consider the following method. public static void message(in…

Consider the following method. public static void message(int a, int b, int c){ if (a < 10) { if (b < 10) { System.out.print("X"); } System.out.print("Y"); } if (c < 10) { if (b > 10) { System.out.print(“Y”); } else { System.out.print(“Z”); } }} What is printed as a result of the call message (5, 15, 5) ?