Exam 6: Looping

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

Match each term with the correct statement below. -Multiple statements within curly braces

(Multiple Choice)
4.9/5
(38)

On many keyboards, the Break key is also the ____ key.

(Multiple Choice)
5.0/5
(33)

Create an indefinite while loop that will validate that the loop control variable named userNum is less than the constant MAXVALUE. While true, create a println statement to output "Please enter a higher value". Once MAXVALUE is reached, create a final println statement that will output "Max value reached".

(Essay)
4.8/5
(35)

Making a comparison to 0 is slower than making a comparison to any other value.

(True/False)
4.8/5
(42)

How could you rewrite the following code to have the arithmetic performed only once, even if the loop executes 1,000 times? while (x < a + b) // loop body

(Essay)
4.8/5
(43)

Altering a variable within both a for statement and within the block it controls can produce errors that are difficult to find.

(True/False)
4.9/5
(32)

Programmers rarely use indefinite loops when validating input data.

(True/False)
4.8/5
(34)

Match each term with the correct statement below. -The technique of combining two loops into one

(Multiple Choice)
4.9/5
(36)

How does a for loop work?

(Essay)
4.7/5
(38)

If a(n) ____________________ is altered both within the for statement and within the block it controls, it can be very difficult to follow the program's logic.

(Short Answer)
4.7/5
(39)

As long as methods do not depend on one another, ____ is a technique that can improve loop performance by combining two loops into one.

(Multiple Choice)
4.8/5
(41)

Write a for loop that will initialize the variables value1 to 11 and value2 to 19. Create a test section of the for statement that will test if value1 is greater than 10 and value2 is less than 20. Finally, end the for statement by incrementing value1 by 1. In the loop body, write a println statement that will display the contents of value1.

(Essay)
4.9/5
(33)

Besides initializing, testing, and incrementing, you can also perform other tasks with a for loop. What are some of these tasks? Use code samples as examples.

(Essay)
4.7/5
(39)

Describe how a loop is controlled by a Boolean expression.

(Essay)
4.9/5
(35)

Match each term with the correct statement below. -Part of the Thread class in the java.lang package

(Multiple Choice)
5.0/5
(37)

Describe the purpose of a loop control variable. How are Boolean values and a while loop involved?

(Essay)
4.9/5
(41)

When nesting loops, the variable in the outer loop changes more frequently.

(True/False)
4.8/5
(39)

Match each term with the correct statement below. -The value that determines whether loop execution continues

(Multiple Choice)
4.9/5
(32)

In order to improve loop performance, it's important to make sure the loop does not include unnecessary operations or statements.

(True/False)
4.8/5
(35)

Shortcut operators are a programmer's only choice when incrementing or accumulating a variable's value.

(True/False)
4.8/5
(27)
Showing 41 - 60 of 72
close modal

Filters

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