Question: What is sum after the following loop terminates? int sum = 0; int item = 0; do { item++; sum += item; if (sum >
What is sum after the following loop terminates?
int sum = 0; int item = 0; do { item++; sum += item; if (sum > 4) break; } while (item < 5);
| A. | 6 | |
| B. | 7 | |
| C. | 8 | |
| D. | 5 |
The statement System.out.printf("%10s", 123456) outputs ________. (Note: in rhe answers * represents a space)
| A. | 23456***** | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| B. | 123456**** | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| C. | ****123456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| D. | 12345***** Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
