Exam 6: Looping

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags
Match each term with the correct statement below.
Premises:
Multiply and assign
Responses:
binary operators
% =
loop control variable
Correct Answer:
Verified
Premises:
Responses:
Multiply and assign
binary operators
(Matching)
4.7/5
(28)

How could a programmer identify and escape from an infinite loop?

(Essay)
4.9/5
(41)

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
(30)

A for loop provides a convenient way to create a(n) ____ loop.

(Multiple Choice)
4.8/5
(48)

public class IncrDemo {     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)
4.9/5
(35)

What is loop fusion? Write a code segment that uses loop fusion to call two methods, method1 and method2 , 10 times each.

(Essay)
4.8/5
(36)
Match each term with the correct statement below.
Premises:
Remainder and assign
Responses:
loop fusion
for loop
decrementing
Correct Answer:
Verified
Premises:
Responses:
Remainder and assign
loop fusion
(Matching)
4.8/5
(29)
Match each term with the correct statement below.
Premises:
Subtracting 1 from a variable
Responses:
data validation
block
empty body
Correct Answer:
Verified
Premises:
Responses:
Subtracting 1 from a variable
data validation
(Matching)
4.8/5
(33)

Explain why an infinite loop might not actually execute infinitely.

(Essay)
4.8/5
(42)

With ____ loops, the order of the conditional expressions can be important.

(Multiple Choice)
4.9/5
(49)

Many seasoned programmers start counter values at 1 because they are used to doing so when working with arrays.

(True/False)
4.8/5
(37)

A(n) ____ is a body with no statements in it.

(Multiple Choice)
4.8/5
(34)

Before entering a loop, the first input statement, or ____, is retrieved.

(Multiple Choice)
4.8/5
(38)

What kind of loop is this: response = keyboard.nextInt(); While (response == 1) {     System.out.print ("Enter 1 to continue; 0 to stop");     response = keyboard.nextInt(); }

(Multiple Choice)
4.9/5
(31)

​ while(count < getNumberOfEmployees()) Examine the statement above. Write the code that will result in more efficient program execution assuming the result of getNumberOfEmployees() stays the same.

(Essay)
4.9/5
(34)

What would happen if a semicolon is mistakenly placed at the end of a partial statement of a while loop with a Boolean expression and with an empty body?

(Essay)
5.0/5
(34)

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

(Multiple Choice)
4.8/5
(37)
Showing 61 - 77 of 77
close modal

Filters

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