Exam 6: Looping

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

Describe how a loop is controlled by a Boolean expression.

(Essay)
4.8/5
(27)

What are some unconventional uses of the three sections inside the parentheses of a  for loop? Show at least three examples using code.

(Essay)
4.8/5
(45)
Match each term with the correct statement below.
Premises:
Part of the Thread class in the java.lang package
Responses:
accumulating
block
do-nothing loop
Correct Answer:
Verified
Premises:
Responses:
Part of the Thread class in the java.lang package
accumulating
(Matching)
4.8/5
(43)

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

(Multiple Choice)
4.8/5
(36)

A ____ is a structure that allows repeated execution of a block of statements.

(Multiple Choice)
4.9/5
(40)

How does a for loop work?

(Essay)
4.8/5
(39)
Match each term with the correct statement below.
Premises:
A body with no statements
Responses:
% =
empty body
prefix ++
Correct Answer:
Verified
Premises:
Responses:
A body with no statements
% =
(Matching)
4.8/5
(38)

What is wrong with the following code? while (4>2)  System.out.println ("Hi there");

(Multiple Choice)
4.8/5
(34)

____ is a technique that can improve loop performance by combining two loops into one.

(Multiple Choice)
5.0/5
(37)

A(n) ____ loop is a special loop that is used when a definite number of loop iterations is required.

(Multiple Choice)
4.8/5
(41)

A(n) ____ loop is one that performs no actions other than looping.

(Multiple Choice)
4.9/5
(36)

Provide a code example of a pretest loop and an example of a posttest loop.

(Essay)
4.8/5
(33)

counterLoop = 1; while(counterLoop < 10); {      System.out.println("Hello");      counterLoop = counterLoop + 1; } What is the problem in the above while loop? How would you correct the problem?

(Essay)
4.8/5
(31)

A(n) ____ is a kind of indefinite loop.

(Multiple Choice)
4.7/5
(41)

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

(True/False)
4.8/5
(31)

Programmers rarely use indefinite loops when validating input data.

(True/False)
4.8/5
(37)

You use a unary minus sign preceding a value to make the value ____.

(Multiple Choice)
4.9/5
(45)

Why would a loop with altered user input be considered a type of indefinite loop? Give an example.

(Essay)
4.8/5
(43)

The process of repeatedly increasing a value by some amount is known as ____.

(Multiple Choice)
4.9/5
(36)

What is the output of the following code: loopCount = 1; While(loopCount < 3) {    System.out.println("Hello");    loopCount = loopCount + 1; }

(Multiple Choice)
4.7/5
(30)
Showing 21 - 40 of 77
close modal

Filters

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