Exam 6: Looping
Exam 1: Creating Java Programs68 Questions
Exam 2: Using Data74 Questions
Exam 3: Using Methods, Classes, and Objects68 Questions
Exam 4: More Object Concepts67 Questions
Exam 5: Making Decisions70 Questions
Exam 6: Looping72 Questions
Exam 7: Characters, Strings, and the Stringbuilder73 Questions
Exam 8: Arrays74 Questions
Exam 9: Advanced Array Concepts74 Questions
Exam 10: Introduction to Inheritance70 Questions
Exam 11: Advanced Inheritance Concepts70 Questions
Exam 12: Exception Handling65 Questions
Exam 13: File Input and Output74 Questions
Exam 14: Introduction to Swing Components74 Questions
Exam 15: Advanced Gui Topics69 Questions
Exam 16: Graphics74 Questions
Exam 17: Applets, Images, and Sound72 Questions
Select questions type
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)