Multiple choice

Directions: Use the following program segment.

SELECT CASE Choice CASE 10 Price = Quantity * UnitPrice CASE 20 Price = Quantity * UnitPrice * 0.95 CASE 30 Price = Quantity * UnitPrice * 0.90 CASE ELSE PRINT "Invalid Choice." END SELECT

What happens if Choice equals 21?

  1. Price equals Quantity- UnitPrice.

  2. Price equals 95% of Quantity - UnitPrice.

  3. Price equals 90% of Quantity -UnitPrice.

  4. Invalid Choice is displayed.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

When Choice equals 21, it doesn't match any of the specific CASE values (10, 20, or 30). The SELECT CASE structure falls through to the CASE ELSE clause, which executes the PRINT statement displaying "Invalid Choice." None of the Price calculations are performed because no matching CASE was found. Options A, B, and C are all incorrect because they suggest Price calculations occur, which they don't.