Exam 3: Decision Structures

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

If you prematurely terminate an if statement with a semicolon, the compiler will

(Multiple Choice)
4.8/5
(28)

The boolean expression in an if statement must evaluate to

(Multiple Choice)
4.8/5
(34)

In Java, when a character is stored in memory, it is actually the __________ that is stored.

(Multiple Choice)
4.8/5
(28)

What will 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
(34)

__________ operators are used to determine whether a specific relationship exists between two values.

(Multiple Choice)
5.0/5
(40)

What will be the value of discountRate after the following statements are executed? double discountRate = 0.0; Int purchase = 100; If (purchase > 1000) DiscountRate = 0.05; Else if (purchase > 750) DiscountRate = 0.03; Else if (purchase > 500) DiscountRate = 0.01;

(Multiple Choice)
4.8/5
(29)

Programs never need more than one path of execution.

(True/False)
4.7/5
(42)

A block of code is enclosed in a set of

(Multiple Choice)
4.7/5
(38)

What is the value of ans, x, and y after the following statements are executed? int ans = 0, x = 15, y = 25; If ( x >= y) { Ans = x + 10; X -=y; } Else { Ans = y + 10; Y += x; }

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

The switch statement is a

(Multiple Choice)
4.8/5
(31)

Which of the following will format 12.7801 to display as $12.78?

(Multiple Choice)
4.7/5
(34)

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

In a switch statement, each of the case values must be unique.

(True/False)
4.7/5
(39)

What would be the value of discountRate after the following statements are executed? double discountRate = 0.0; Int purchase = 1250; If (purchase > 1000) DiscountRate = .05; If (purchase > 750) DiscountRate = .03; If (purchase > 500) DiscountRate = .01; Else DiscountRate = 0;

(Multiple Choice)
4.8/5
(33)

What will be displayed after the following statements are executed? int y = 10; If (y == 10) { Int x = 30; X += y; System.out.println(x); }

(Multiple Choice)
4.9/5
(41)

What will be the value of x after the following statements are executed? int x = 75; Int y = 60; If (x > y) X = x - y;

(Multiple Choice)
4.8/5
(32)

What is the value of x after the following code has been executed? int x = 75; Int y = 90; If (x != y) X += y;

(Multiple Choice)
4.8/5
(35)

What is the value of charges after the following code has been executed? double charges, rate = 7.00; Int time = 180; Charges = time <= 119 ? rate * 2 : Time / 60.0 * rate;

(Multiple Choice)
4.7/5
(39)

Java requires that the boolean expression being tested by an if statement be enclosed in

(Multiple Choice)
4.9/5
(37)
Showing 21 - 40 of 58
close modal

Filters

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