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

Which of the following statements will cause the price to be 90% of Quantity - UnitPrice?

  1. CASE = 20 + 10

  2. Choice = 10 + 10

  3. Choice = 20 + 10

  4. Choice = 20

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

The SELECT CASE structure evaluates Choice against each CASE value. For 90% discount (0.90 multiplier), we need Choice = 30. Option C shows Choice = 20 + 10, which equals 30. This would execute CASE 30, applying the 0.90 discount factor. Option A has incorrect syntax with CASE = instead of Choice =, Option B gives Choice = 20 (95% discount), and Option D directly assigns Choice = 20.