Consider the following method. public void test(int x){    i…

Consider the following method. public void test(int x){    int y;   if (x % 2 == 0)       y = 3;   else if (x > 9)       y = 5;   else        y = 1;   System.out.println(“y = ” + y);} Which of the following test data sets would test each possible output for the method?

Consider the following code segment. int num = /* initial va…

Consider the following code segment. int num = /* initial value not shown */;boolean b1 = true;if (num > 0){ if (num >= 100) { b1 = false; }}else{ if (num >= -100) { b1 = false; }} Which of the following statements assigns the same value to b2 as the code segment assigns to b1 for all values of num?

Consider the following code segment. double regularPrice = 1…

Consider the following code segment. double regularPrice = 100; boolean onClearance = true; boolean hasCoupon = false; double finalPrice = regularPrice; if(onClearance) {      finalPrice -= finalPrice * 0.25; } if(hasCoupon) {      finalPrice -= 5.0; } System.out.println(finalPrice); What is printed as a result of executing the code segment?