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
Describe how a sequence structure works.
Free
(Essay)
5.0/5
(83)
Correct Answer:
In a sequence structure, one step follows another unconditionally. A sequence structure might contain any number of steps in which one task follows another with no chance to branch away or skip a step.
You can use the ____, which is written as || , if you want some action to occur when at least one of two conditions is true.
Free
(Multiple Choice)
4.9/5
(78)
Correct Answer:
A
A(n) ____ is a series of if statements that determine whether a value falls within a specified range.
Free
(Multiple Choice)
4.7/5
(78)
Correct Answer:
D
The compiler does not take indentation into account when compiling code, but consistent indentation can help readers understand a program's ____.
(Multiple Choice)
4.8/5
(71)
What is a conditional operator? Show an example of an expression that uses a conditional operator.
(Essay)
5.0/5
(72)
Match each term with the correct statement below.
Premises:
Has three operands
Responses:
dual-alternative
switch statement
!
Correct Answer:
Premises:
Responses:
(Matching)
4.7/5
(81)
Create an if statement that will check if the variable salesAmt is greater than the constant SALES_QUOTA . If true, create a block statement that will calculate salesAmt * BONUS_PERCENT and store the result in a variable named bonusPay . The block statement will then compute totalPay by adding salesAmt to bonusPay . Outside of the if structure, add a println statement that will output the totalPay value. Be sure to use curly braces and semicolons appropriately.
(Essay)
4.8/5
(69)
In the switch structure, break is followed by one of the possible values for the test expression and a colon.
(True/False)
4.9/5
(89)
A ____ chooses among alternative courses of action based on some value within a program.
(Multiple Choice)
4.9/5
(90)
When an expression containing a ____ is part of an if statement, the assignment is illegal.
(Multiple Choice)
4.7/5
(82)
When you block statements, you must remember that any ____ you declare within a block is local to that block.
(Multiple Choice)
4.9/5
(69)
The simplest statement you can use to make a decision is the ____ statement.
(Multiple Choice)
4.9/5
(69)
Using the above flowchart and code, why will the above statements execute but provide unintended results? Write the statement correctly.
(Essay)
4.9/5
(77)
In Boolean expressions, when you want to execute more than one statement based on the results of the expression, you place statements within a block. What is a block and why is it important in decision statements? Why are curly braces crucial when blocking an if statement?
(Essay)
4.8/5
(69)
Although it is possible to block statements that depend on an if , you cannot likewise block statements that depend on an else .
(True/False)
4.8/5
(59)
Create an if…else statement that will check if the maxValue variable is equal to 100. If true, create a println statement that will output "Max reached". If false, create a println statement to output "Keep trying".
(Essay)
4.9/5
(79)
if (maxValue = 100)
System.out.println ("Your limit has been reached");
Why is the above if statement illegal? How would you fix it?
(Essay)
4.9/5
(103)
When you place a block within an if statement, it is crucial to place the ____ correctly.
(Multiple Choice)
4.9/5
(78)
Match each term with the correct statement below.
Premises:
A double equal sign
Responses:
flowchart
!
Boolean values
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(88)
Statements in which an if structure is contained inside another if structure are commonly called ____ if statements.
(Multiple Choice)
4.8/5
(67)
Showing 1 - 20 of 80
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)