Exam 4: Decision Structures

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

All it takes for an OR expression to be true is for one of the subexpressions to be true.

(True/False)
5.0/5
(38)

What will be displayed after the following statements are executed? Int hours = 30; Double pay, payRate = 10.00; Pay = hours <= 40 ? hours * payRate : hours * payRate * 2.0; System.out.println(pay);

(Multiple Choice)
4.9/5
(42)

What will be displayed when the following code is executed? Double x = 45678.259; DecimalFormat formatter = new DecimalFormat("#,###,##0.00"); JOptionPane.showMessageDialog(null,formatter.format(x));

(Multiple Choice)
4.8/5
(38)

What will be displayed when the following code is executed? Double x = 45678.259; DecimalFormat formatter = new DecimalFormat("#,##0.0"); JOptionPane.showMessageDialog(null,formatter.format(x));

(Multiple Choice)
4.7/5
(44)

What will be the values of ans, x, and y after the following statements are executed? Int ans = 35, x = 50, y = 50; If (x >= y) { Ans = x + 10; X -=y; } Else { Ans = y + 10; Y += x; }

(Multiple Choice)
4.8/5
(36)

Which of the following expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2?

(Multiple Choice)
4.9/5
(34)

Which of the following expressions determines whether the char variable chrA is not equal to the letter 'A'?

(Multiple Choice)
4.9/5
(30)

A ________ is a boolean variable that signals when some condition exists in the program.

(Multiple Choice)
4.8/5
(34)

Which of the following strings could be passed to the DecimalFormat constructor to display 12.78 as 012.8?

(Multiple Choice)
4.8/5
(43)

If str1 and str2 are both String objects, which of the following expressions will correctly determine whether or not they are equal?

(Multiple Choice)
4.9/5
(29)

The if-else statement will execute one group of statements if its boolean expression is true, or another group if its boolean expression is false.

(True/False)
4.8/5
(44)

An important style rule you should adopt for writing if statements is to write the conditionally executed statement on the line after the if statement.

(True/False)
4.9/5
(42)

Which of the following strings could be passed to the DecimalFormat constructor to display 12.78 as 12.8%?

(Multiple Choice)
4.8/5
(39)

Which of the following expressions will determine whether x is less than or equal to y?

(Multiple Choice)
4.8/5
(40)

When testing for character values, the switch statement does not test for the case of the character.

(True/False)
4.8/5
(36)

The ________ statement is used to create a decision structure, which allows a program to have more than one path of execution.

(Multiple Choice)
4.7/5
(35)

When a character is stored in memory, it is actually the ________ that is stored.

(Multiple Choice)
4.7/5
(41)

In a switch statement, if two different values for the CaseExpression would result in the same code being executed, you must have two copies of the code, one after each CaseExpression.

(True/False)
4.7/5
(35)

What will be displayed when the following code is executed? Int y = 10; If (y == 10 { Int x = 30; X += y; System.out.println(x); }

(Multiple Choice)
4.7/5
(28)

What would be the value of discountRate after the following statements are executed? Double discountRate = 0.0; Int purchase = 1250 Char cust = 'N'; If (purchase > 1000 If (cust == 'Y') DiscountRate = 0.05; Else DiscountRate = 0.04; Else if (purchase > 750) If (cust == 'Y') DiscountRate = 0.04; Else DiscountRate = 0.03; Else DiscountRate = 0.0;

(Multiple Choice)
4.8/5
(39)
Showing 21 - 40 of 40
close modal

Filters

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