How many times does the loop execute in the following code fragment? int i; for (i = 0; i < 50; i = i + 4) { System.out.println(i); }
In the __________ loop header, you can include multiple upda…
In the __________ loop header, you can include multiple update expressions, separated by commas, but it is not recommended.
What is the result of the following expression? double d = 2…
What is the result of the following expression? double d = 2.5 + 4 * -1.5 – (2.5 + 4) * -1.5;
Which one of the following reserved words is used in Java to…
Which one of the following reserved words is used in Java to represent a value without a fractional part?
What is the output of the following code snippet? double sal…
What is the output of the following code snippet? double salary = 55000; double cutOff = 65000; double minSalary = 40000; if (minSalary > salary) { System.out.println(“Minimum salary requirement is not met.”); } if (cutOff < salary) { System.out.println("Maximum salary limit is exceeded."); } else { System.out.println("Salary requirement is met."); }
What is wrong with the following code snippet? int size = 42…
What is wrong with the following code snippet? int size = 42; int cost = 9.99; System.out.println(“size = ” + size); System.out.println(” cost = ” + cost);
What is the output of the code fragment given below? int i =…
What is the output of the code fragment given below? int i = 0; int j = 0; while (i < 27) { i = i + 2; j++; } System.out.println("j=" + j);
Assume the method doSomething has been defined as follows: p…
Assume the method doSomething has been defined as follows: public static void doSomething (int; values = values; values = values; } What does the method do?
A store applies a 15 percent service charge on all items wit…
A store applies a 15 percent service charge on all items with a price of at least $150. No service charge is otherwise applicable. Which of the following DOES NOT correctly compute the service charge?
Assume the variable numbers has been declared to be an array…
Assume the variable numbers has been declared to be an array that has at least one element. Which is the following represents the last element in numbers?