Question: Java 1: 1) Choose a for statement header that will vary the control variable x in increments of 5 from 0 up through 100; then
Java 1:
1) Choose a for statement header that will vary the control variable x in increments of 5 from 0 up through 100; then choose a for statement header that decrements by 5 from 100 to 0. You don't have to code a body.
Choose all the answers that are correct. All or nothing.
| a. | for(int x = 100; x >= 0; x-5) | |
| b. | for(int x = 0; x < 100; x += 5) | |
| c. | for(int x = 0; x <= 100; x += 5) | |
| d. | for(int x = 100; x >= 0; x -= 5) | |
| e. | for(int x = 0; x <= 100; x++) | |
| f. | for(int x = 100; x <= 0; x -= 5) |
2) Given:
boolean spinach = false; boolean lasagna = true; char salad = 'y';
spinach ^ lasagna && salad == y
Choose all the answers that are correct. All or nothing.
| a. | lasagna && salad == 'y' will be evaluated last. | |
| b. | spinach ^ lasagna will be evaluated first. | |
| c. | The truth value of the complex condition is "true". | |
| d. | The truth value of spinach ^ lasagna will be joined with the truth value for salad == 'y' by the &&. | |
| e. | The truth value of the complex condition is "false". | |
| f. | lasagna && salad == 'y' will be evaluated first. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
