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
____ involves choosing between alternative courses of action based on some value within a program.
(Multiple Choice)
4.9/5
(89)
Match each term with the correct statement below.
Premises:
Two possible courses of action
Responses:
||
Boolean values
dual-alternative
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(82)
public class Student
{
private int studentNum;
private int studentScore;
public int MAX_NUM = 500;
public int MAX_SCORE = 100;
Student(int num, int score)
{
}
Decision making can be used to control the allowed values in an object's fields. In the above code, the Student class contains two fields that hold a student number and a score. A constructor accepts values for these fields as parameters. Write the code between the curly brackets that will determine whether the value of num is less than the MAX_NUM constant. If true, assign the value of num to studentNum . Otherwise, assign the value of MAX_NUM to the studentNum . Then check if the value of score is less than or equal to MAX_SCORE . If true, assign the value of score to studentScore . Otherwise, assign 0 to studentScore .
(Essay)
4.7/5
(86)
Create an if statement that checks if the variable salesAmt is greater than or equal to the QUOTA_AMT constant. Use the logical OR operator to also check if salesAmt is greater than or equal to the HIGH_SALES constant. If either expression is true, assign the value of the LARGE_QUOTA constant to the variable bonusAmt .
(Essay)
4.8/5
(77)
Using the above flowchart, write the nested if…else statements that will correctly choose among alternative courses of action based on the values of itemsSold and totalValue .
(Essay)
5.0/5
(65)
A(n) ____ is particularly useful when two conditions must be met before some action is taken.
(Multiple Choice)
4.8/5
(76)
When using equals and not equals for comparisons with objects, you compare the objects' ____ instead of actual values.
(Multiple Choice)
4.8/5
(73)
An alternative to using a Boolean expression, such as quizScore == 10 , is to store the Boolean expression's value in a Boolean variable. How could you express this in Java?
(Essay)
4.8/5
(92)
When you use the && operator, you must include a complete _____ on each side.
(Multiple Choice)
4.9/5
(77)
Match each term with the correct statement below.
Premises:
Sequence of steps written in diagram form
Responses:
sequence structure
||
!
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(89)
When working with logical operators, you can always use ____ to change precedence.
(Multiple Choice)
4.9/5
(69)
You use the NOT operator, which is written as the exclamation point (!), to negate the result of any Boolean expression.
(True/False)
4.8/5
(91)
An alternative to using a Boolean expression, such as someVariable == 10 , is to store the Boolean expression's value in a Boolean variable.
(True/False)
4.8/5
(82)
When writing a statement with the two-line format, you must be sure to type a semicolon at the end of the first line in order to ensure accurate results.
(True/False)
4.9/5
(69)
When you create a block, you must place multiple statements within it.
(True/False)
4.7/5
(74)
Match each term with the correct statement below.
Premises:
One step follows another unconditionally
Responses:
||
logical AND operator
switch statement
Correct Answer:
Premises:
Responses:
(Matching)
4.7/5
(85)
Within an if or an else statement, how can you code as many dependent if statements as you need and why is this useful?
(Essay)
4.8/5
(75)
Match each term with the correct statement below.
Premises:
Tool that helps plan a program's logic by writing down steps in plain English
Responses:
pseudocode
!
||
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(94)
You write pseudocode in everyday language, not the syntax used in a programming language.
(True/False)
4.8/5
(85)
Showing 41 - 60 of 80
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)