Exam 5: Making Decisions

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

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:
Verified
Premises:
Responses:
Separated with a question mark and a colon
logical AND operator
(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:
Verified
Premises:
Responses:
Anything a method does other than altering a local variable or returning a value
equality
(Matching)
4.9/5
(75)

The AND operator is written as two ____.

(Multiple Choice)
4.8/5
(71)

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:
Verified
Premises:
Responses:
The logical NOT operator
side effect
(Matching)
4.9/5
(81)

Which operator has the highest precedence?

(Multiple Choice)
4.8/5
(97)

Why do programmers use pseudocode?

(Essay)
4.8/5
(75)

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)

Explain the use of the NOT operator.

(Essay)
4.9/5
(71)

  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 . 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:
Verified
Premises:
Responses:
An alternative to using a series of nested if statements
equality
(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
close modal

Filters

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