Exam 6: Loops

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

For which input values will the following loop not correctly compute the maximum of the values? For which input values will the following loop not correctly compute the maximum of the values?

Free
(Multiple Choice)
4.8/5
(28)
Correct Answer:
Verified

D

How many times does the following code fragment display "Hi"? How many times does the following code fragment display Hi?

Free
(Multiple Choice)
4.7/5
(35)
Correct Answer:
Verified

C

The code snippet below checks whether a given number is a prime number.What will be the result of executing it? The code snippet below checks whether a given number is a prime number.What will be the result of executing it?

Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
Verified

B

Which of the following statements expresses why the following code is considered bad form? for (rate = 5; years-- > 0; System.out.println(balance)) ... I.unrelated expressions in loop header II.doesn't match expected for loop idiom III.loop iteration is not clear

(Multiple Choice)
4.9/5
(49)

How many times does the following loop execute? How many times does the following loop execute?

(Multiple Choice)
4.9/5
(39)

Which of the following loops will print the odd numbers between 0 and 20?

(Multiple Choice)
4.8/5
(46)

The for loop header can contain multiple variables of the same type and multiple update expressions, separated by commas: for (int i = 0; j = 3; i <= 5; i++, j--) Which loop below correctly implements the same loop using a single counter in the loop control?

(Multiple Choice)
4.9/5
(29)

How many times does the following loop execute? How many times does the following loop execute?

(Multiple Choice)
4.7/5
(25)

Which of the following loop(s) could possibly not enter the loop body at all? I.the for loop II.the while loop III.the do loop

(Multiple Choice)
4.9/5
(41)

What will be the result of running the following code fragment? What will be the result of running the following code fragment?

(Multiple Choice)
4.8/5
(38)

What does the following loop compute? What does the following loop compute?

(Multiple Choice)
4.9/5
(40)

What is the output of the following code snippet? What is the output of the following code snippet?

(Multiple Choice)
4.9/5
(37)

What is the output of the code below? What is the output of the code below?

(Multiple Choice)
4.9/5
(34)

What is the output of the code snippet given below? What is the output of the code snippet given below?

(Multiple Choice)
4.8/5
(39)

What output does this while loop generate? What output does this while loop generate?

(Multiple Choice)
4.8/5
(32)

What does the method below return? What does the method below return?

(Multiple Choice)
4.7/5
(41)

What changes do you need to make in the following code snippet to display "Let us learn Java" exactly 10 times? What changes do you need to make in the following code snippet to display Let us learn Java exactly 10 times?

(Multiple Choice)
4.8/5
(44)

What is the last output line of the code snippet given below? What is the last output line of the code snippet given below?

(Multiple Choice)
4.8/5
(37)

What will be printed by the statements below? What will be printed by the statements below?

(Multiple Choice)
4.9/5
(38)

Assuming the variable n is an integer that stores a positive value, which of the following is a loop with a bound that could be problematic?

(Multiple Choice)
4.9/5
(38)
Showing 1 - 20 of 107
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)