Exam 6: Looping

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

Match each term with the correct statement below. -Subtracting 1 from a variable

(Multiple Choice)
4.9/5
(44)

The ____________________ loop is the posttest loop used in Java.

(Short Answer)
4.8/5
(37)

Which is an infinite loop?

(Multiple Choice)
4.9/5
(42)

How are nested loops implemented in a loop structure?

(Essay)
4.8/5
(44)

It is important that the loop control ____ be altered within the body of the loop.

(Multiple Choice)
5.0/5
(41)

A loop that never ends is called a(n) ____ loop.

(Multiple Choice)
4.8/5
(23)

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

(Essay)
4.7/5
(32)

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

(Multiple Choice)
4.9/5
(37)

Explain why an infinite loop might not actually execute infinitely.

(Essay)
4.8/5
(34)

How many times will outputLabel be called? for(customer = 1; customer <= 20; ++customer) For(color = 1; color <= 3; ++color) OutputLabel();

(Multiple Choice)
4.9/5
(42)

When you want to increase a variable's value by exactly 1, use the ____.

(Multiple Choice)
4.8/5
(37)

public class CaseDemo { public static void main(String[] args) { int myVal, yourVal; myVal = 10; System.out.println("My initial value is " + myVal); yourVal = ++myVal; System.out.println("My new value is " + myVal); System.out.println("Your value is " + yourVal): } } Using the above code, describe how the three println output commands will appear. Explain the values stored in the variables during code execution.

(Essay)
5.0/5
(38)

What are some of the shortcuts Java provides programmers for incrementing and accumulating? Give examples of statements.

(Essay)
4.7/5
(47)

The order of the conditional expressions in the following is most important within a(n) ____ loop. while(requestedNum > LIMIT || requestedNum < 0)…

(Multiple Choice)
4.8/5
(39)

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

(Multiple Choice)
4.8/5
(33)

The ____ loop checks the value of the loop control variable at the bottom of the loop after one repetition has occurred.

(Multiple Choice)
4.7/5
(39)

Match each term with the correct statement below. -A shortcut for incrementing and accumulating

(Multiple Choice)
4.9/5
(37)

Which of the following is NOT a valid method to increase a variable named score by 1?

(Multiple Choice)
4.9/5
(41)

Loop control variables can be evaluated at the start or the end of the loop. Describe both pretest loops and posttest loops. How do do…while loops execute?

(Essay)
4.9/5
(28)

while(10 > 1) { System.out.println("Enter a new value"); } Identify the problem that exists in the above code.

(Essay)
4.8/5
(37)
Showing 21 - 40 of 72
close modal

Filters

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