Exam 5: Making Decisions

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

Just as you can block statements that depend on an if , you can also block statements that depend on a(n) ____.

(Multiple Choice)
4.8/5
(80)

The simplest statement you can use to make a decision is the ____ statement.

(Multiple Choice)
4.8/5
(85)

   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 . 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)
4.7/5
(78)

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.7/5
(78)

When an expression containing a ____ is part of an if statement, the assignment is illegal.

(Multiple Choice)
4.9/5
(84)

Why would a programmer use an && operator when using nested if statements?

(Essay)
4.9/5
(55)
Match each term with the correct statement below.
Two possible courses of action
conditional operator
Separated with a question mark and a colon
pipes
A double equal sign
logical AND operator
Correct Answer:
Verified
Premises:
Responses:
Two possible courses of action
conditional operator
Separated with a question mark and a colon
pipes
A double equal sign
logical AND operator
Two ampersands
equality
true and false
Boolean values
Used in the OR operator
!
An alternative to using a series of nested if statements
switch statement
The logical NOT operator
relational operator
> or
dual-alternative
(Matching)
4.8/5
(69)

____________________ is a tool that helps programmers plan a program's logic by writing plain English statements.

(Short Answer)
4.8/5
(85)

  Using the flowchart above, which decision statement will correctly check that hoursWorked is greater than or equal to the FULL_WEEK constant? Using the flowchart above, which decision statement will correctly check that hoursWorked is greater than or equal to the FULL_WEEK constant?

(Multiple Choice)
4.7/5
(100)

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.8/5
(84)

Both & and | are valid Java operators, but a single & or | with integer operands operate on individual ____________________ rather than making comparisons in logical conditions as && and || do.

(Short Answer)
4.8/5
(71)

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
(78)

When working with logical operators, you can always use ____ to change precedence.

(Multiple Choice)
4.8/5
(88)

Describe how a sequence structure works.

(Essay)
4.9/5
(72)

Why do programmers use pseudocode?

(Essay)
4.9/5
(82)

When you use nested if statements, you must pay careful attention to placement of any else clauses.

(True/False)
5.0/5
(88)

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)
5.0/5
(84)

When you create a block, you must place multiple statements within it.

(True/False)
4.9/5
(56)

You can leave out the ____ statements in a switch structure.

(Multiple Choice)
4.9/5
(76)

Computers contain switches that are set to on or off.

(True/False)
4.7/5
(63)
Showing 41 - 60 of 66
close modal

Filters

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