Question

Question 21 The loop condition can be a complex condition involving several operators. True OR False...

Question 21

The loop condition can be a complex condition involving several operators.

True OR False

Question 22

final int MAX = 25, LIMIT = 100;

int num1 = 12, num2 = 25, num3 = 87;

if(num3-5 >= 2*LIMIT) {

System.out.println ("apple"); }

else {

System.out.println ("orange"); }

System.out.println("grape");

What prints?

A. Apple

B. Orange

C. Grape

D. apple grape

E. orange grape

F. Nothing.

Question 23

When we use a while loop, we always know in advance how many times the loop body will be executed.

True OR False

Question 24

final int MAX = 25, LIMIT = 100;
int num1 = 12, num2 = 25, num3 = 87;

if (num3 <= MAX) {

System.out.println ("apple"); }

What prints?

A. apple

B. orange

C. Nothing

Question 25

The body of a while loop is executed until the loop condition becomes ________.

A. True

B. False

C. None of the above.

Question 26

When a loop condition is grade >= 90, what values would you test your loop with?

A. 90, 91, 92

B. 91

C. 89, 90, 91

D. 92

E. None of the above.

Question 27

MORE_COWBELL is typical of the way a constant identifier should be named in Java.

True OR False

Question 28

What does the following loop print?

for(inti =1;i<=10;i=i+2) {

System.out.println( i ); }

A. Even numbers 2 through 10

B. 2 followed by the odd numbers through 9

C. 1 through 10

D, 1 through 9

E. Odd numbers 1 through 9

Question 29

When you use a while loop to compute the sum of several values, you should initialize the variables holding the sum to ________ .

A. 0

B. 1

C. You don't need to initialize a summation variable.

D. None of the above.

Question 30

Assuming the for loop header for( i = 0; i <= 7; i++ ), and the variable i has been properly declared as an int, what will be value of i after we exit the loop?

A. 0

B. 6

C. 7

D. 8

E. 9

F. i will be out of scope

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Question 21 The loop condition can be a complex condition involving several operators. True OR False...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • java question, my questions are in the following codes with comments, just answer next or under...

    java question, my questions are in the following codes with comments, just answer next or under it thanks! theres only few, so no worry. import java.security.SecureRandom; public class clsTestRand {    public static void main(String[] args) {        // TODO Auto-generated method stub        //int num1, num2, num3, num4, num5, num6;        int num1 = 0;        int num2 = 0;        int num3 = 0;        int num4 = 0;        int...

  • Question 37 The body of a while loop is executed until the loop condition becomes true...

    Question 37 The body of a while loop is executed until the loop condition becomes true false None of the above.

  • QUESTION 1 Which statement results in the value false? The value of count is 0; limit...

    QUESTION 1 Which statement results in the value false? The value of count is 0; limit is 10. (count != 0)&&(limit < 20) (count == 0)&&(limit < 20) (count != 0)||(limit < 20) (count == 0)&&(limit < 20) 10 points    QUESTION 2 If this code fragment were executed in an otherwise correct and complete program, what would the output be? int a = 3, b = 2, c = 5 if (a > b) a = 4; if (...

  • 1. (a) Before entering any while loop, the while loop condition is. . . A. true...

    1. (a) Before entering any while loop, the while loop condition is. . . A. true B. false C. true or false (b) At the beginning of each iteration, a while loop condition is. . . A. true B. false C. true or false (c) When the loop terminates, a while loop condition is. . . A. true B. false C. true or false (d) Which of the following statements will not cause a compile-time error? A. byte b =...

  • 25. Given the array declaration double xyz [20]: which of the following statements are true? a....

    25. Given the array declaration double xyz [20]: which of the following statements are true? a. The array may hold up to 20 elements which may be accessed by the subscripts 0 through 20 b. The array may hold up to 21 elements which may be accessed by the subscripts 0 through 20 c. The array may hold up to 21 elements which may be accessed by the subscripts 0 through 19 d. The array may hold up to 20...

  • A Hamiltonian Cycle is any loop within a graph. A True False Question 25 2.38 Points...

    A Hamiltonian Cycle is any loop within a graph. A True False Question 25 2.38 Points A loop is a graph with n vertices connected with n-1 edges. True B False 2.38 Points Question 26 A minimum spanning tree is a loop. I E True B False

  • java QUESTION 4 Which of the following statements about a do...while repetition statement is true? A....

    java QUESTION 4 Which of the following statements about a do...while repetition statement is true? A. The body of a do...while loop is executed only if the terminating condition is true. B. The body of a do...while loop is executed only once. C. The body of a do...while loop is always executed at least once. D. None of the above QUESTION 5 To exit out of a loop completely and change the flow of control to the first line after...

  • QUESTION 21 while True: , in Python, can be used to create an infinite loop. True...

    QUESTION 21 while True: , in Python, can be used to create an infinite loop. True False 2 points    QUESTION 22 The Python Framework does inform you where an error occurred True False 2 points    QUESTION 23 ____ is a critical component to being able to store data and information long term. File Access Memory Print function with 2 points    QUESTION 24 Error handling is also known as ___ handling Result Recursion Exception Crash 2 points   ...

  • Eclipse Java Oxygen Question 11 pts A compile-time error occurs when Group of answer choices c....

    Eclipse Java Oxygen Question 11 pts A compile-time error occurs when Group of answer choices c. there’s a syntax error in a Java statement a. the Java compiler can’t be located b. bytecodes can’t be interpreted properly c. there’s a syntax error in a Java statement Flag this Question Question 21 pts An error that lets the application run but produces the wrong results is known as a Group of answer choices d. syntax error c. logic error a. runtime...

  • 256 Chapter 4 Loops and Files Review Questions and Exercises Multiple Choice and True/False 1. What...

    256 Chapter 4 Loops and Files Review Questions and Exercises Multiple Choice and True/False 1. What will the printin statement in the following program segment displays int x = 5; System.out.println(x++): b. 6 c. O d. None of these What will the printin statement in the following program segment display? int x = 5: System.out.println(+*x): a. 3 b. 6 C.O d. None of these 3. In the expression number++, the ++ operator is in what mode? a. prefix b. pretest...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT