Exam 5: Making Decisions

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

if (quotaAmt > 100 || sales > 100 && productCode == "C")     bonusAmt = 50; When the above code is executed, which operator is evaluated first?

(Multiple Choice)
4.8/5
(69)

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

What is wrong with the following statement? How could you correct it? if(payRate 60) System.out.println("Error in pay rate");

(Essay)
4.8/5
(71)

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

Explain the use of the NOT operator.

(Essay)
4.7/5
(80)

You write pseudocode in everyday language, not the syntax used in a programming language.

(True/False)
4.8/5
(88)

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

The compiler does not take indentation into account when compiling code, but consistent indentation can help readers understand a program's ____.

(Multiple Choice)
4.9/5
(86)

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

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

Statements in which an if structure is contained inside another if structure are commonly called ____ if statements.

(Multiple Choice)
4.8/5
(79)

The ____ operator is written as the exclamation point ( ! ).

(Multiple Choice)
5.0/5
(91)

When using equals and not equals for comparisons with objects, you compare the objects' ____ instead of actual values.

(Multiple Choice)
4.9/5
(67)

List and explain the keywords used with the switch statement.

(Essay)
4.8/5
(77)

A(n) ____ is a series of if statements that determine whether a value falls within a specified range.

(Multiple Choice)
4.8/5
(85)

When you execute an if…else statement, only one of the resulting actions takes place depending on the evaluation of the ____ following the if .

(Multiple Choice)
5.0/5
(82)

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

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

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

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.9/5
(71)
Showing 21 - 40 of 66
close modal

Filters

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