Exam 5: Making Decisions
Exam 1: Creating Your First Java Classes76 Questions
Exam 2: Using Data81 Questions
Exam 3: Using Methods, Classes and Objects79 Questions
Exam 4: More Object Concepts84 Questions
Exam 5: Making Decisions80 Questions
Exam 6: Looping77 Questions
Exam 7: Characters, Strings and the Stringbuilder82 Questions
Exam 8: Arrays77 Questions
Exam 9: Advanced Array Concepts80 Questions
Exam 10: Introduction to Inheritance78 Questions
Exam 11: Advanced Inheritance Concepts78 Questions
Exam 12: Exception Handling79 Questions
Exam 13: File Input and Output78 Questions
Exam 14: Introduction to Swing Components79 Questions
Exam 15: Using Javafx and Scene Builder65 Questions
Select questions type
Why would a programmer execute more than one statement that depends on the evaluation of a Boolean expression, and how could he or she do it in Java?
(Essay)
4.9/5
(65)
Match each term with the correct statement below.
Premises:
Separated with a question mark and a colon
Responses:
logical AND operator
side effect
Boolean values
Correct Answer:
Premises:
Responses:
(Matching)
4.7/5
(74)
Although not required, it is common procedure to align the keyword if with the keyword else .
(True/False)
4.8/5
(76)
Match each term with the correct statement below.
Premises:
Anything a method does other than altering a local variable or returning a value
Responses:
equality
switch statement
dual-alternative
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(75)
Just as you can block statements that depend on an if , you can also block statements that depend on a(n) ____.
(Multiple Choice)
4.9/5
(78)
Match each term with the correct statement below.
Premises:
The logical NOT operator
Responses:
side effect
||
!
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(81)
Create a switch statement that will test the value of a variable named score . If score has a value of 5, create a println statement that will output "Excellent". If score has a value of 4, create a println statement that will output "Great". If score has a value of 3, create a println statement that will output "Good". If score has a value of 2, create a println statement that will output "Fair". If score has a value of 1, create a println statement that will output "Needs improvement". If score does not contain a matching value for any of the case statements, create a println statement that will output "Retake test".
(Essay)
4.9/5
(78)
A(n) ____ statement is the decision structure you use when you need to take one or the other of two possible courses of action.
(Multiple Choice)
4.7/5
(80)
if(firstValue == secondValue)
{
int total = firstValue + secondVaue;
System.out.println("The values are equal");
}
System.out.println("The total is " + total);
Why will the above println() statement cause an error?
(Essay)
4.9/5
(68)
Use the above flowchart to create the code using the logical && operator to determine if a SALES_BONUS will be assigned to the variable bonus .
(Essay)
4.9/5
(65)
A ____ consists of written steps in diagram form, as a series of shapes connected by arrows.
(Multiple Choice)
4.9/5
(74)
Write a single-alternative if statement that will check if a variable named maxValue is equal to 100. If true, use a println statement to output "You have reached the limit".
(Essay)
4.8/5
(96)
Match each term with the correct statement below.
Premises:
An alternative to using a series of nested if statements
Responses:
equality
flowchart
side effect
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(75)
Write a nested if statement that will check if the variable qtySold is greater than the QTY_QUOTA constant. If true, evaluate a second expression that will check if the variable totalSales is greater than the constant SALES_QUOTA . If the second expression is also true, create an assignment statement that will assign the constant BONUSAMT to the variable bonus . After BONUSAMT is assigned, the if structure ends.
(Essay)
4.7/5
(75)
The ____ statement is useful when you need to test a single variable against a series of exact integer, character, or string values.
(Multiple Choice)
4.8/5
(79)
if(qtySold > QUOTA)
bonusPay = 50;
totalPay = regPay + bonusPay;
System.out.println("Your totalPay amount is " + totalPay);
Why is the above code incorrect? Write the code that will provide the correct result.
(Essay)
4.8/5
(77)
Showing 21 - 40 of 80
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)