Exam 6: Looping

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

A loop controlled by the user is a type of ____ loop.

(Multiple Choice)
4.8/5
(30)

In the expressions b = 8 and c = --b, what value will be assigned to the variable c?

(Multiple Choice)
4.9/5
(45)

____ is the process of ensuring that a value falls within a specified range.

(Multiple Choice)
4.8/5
(44)

public class CompareValues { public static void main(String[] args) { int a = 10, b = 10, c = 11; boolean compare1 = (++b == a); boolean compare3 = (b++ == c); System.out.println("Compare 1 value = " + compare1); System.out.println("Compare 2 value = " + compare2); } } Using the above code, what values will appear in compare1 and compare2 when the println commands execute? Describe how the values of compare1 and compare2 change as the statements are executed.

(Essay)
4.7/5
(43)

Use a(n) ____ loop to execute a body of statements continually as long as the Boolean expression that controls entry into the loop continues to be true.

(Multiple Choice)
4.8/5
(30)

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)
4.8/5
(42)

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

(Multiple Choice)
4.9/5
(35)

public class DoWhileExample { public static void main(String[] args) { int currentValue; ____ ____ ____ ____ ____ } } Complete the code above by writing a do…while posttest loop that will output the value of the variable currentValue in a println statement. After the output statement, add a decrement statement to decrease the value of currentValue by 1. Continue the loop until currentValue is equal to 0.

(Essay)
4.7/5
(27)

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

(True/False)
4.9/5
(36)

Match each term with the correct statement below. -A counter-controlled loop

(Multiple Choice)
4.8/5
(31)

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

(Multiple Choice)
4.8/5
(43)

Why would a programmer use curly braces in the body of a do…while loop?

(Essay)
4.8/5
(39)
Showing 61 - 72 of 72
close modal

Filters

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