Doyle C#, 5th Edition Page 1
C# Programming: From Problem Analysis to Program Design, 5th edition
1. d. true or false
2. a. a * b
6. c. You failed the test! You passed the test!
7. c. &&
12. d. every time the program is executed
13. d. 27
Doyle C#, 5th Edition Page 2
18. c. if (control == 11)
19. b. Logical OR yields true if either or both of the operands are true
20. d. a and b are correct
22. For testing the single value (100), the switch statement could be ok. However, to simulate
23.
if (birdName == “Pelican”)
Console.WriteLine(“Lives near water.”);
Doyle C#, 5th Edition Page 3
24.
if (aValue > bValue)
25. Write conditional expressions to perform the following tests.
a. if (amountOwed > 1000.00)
Console.WriteLine(“Account Overdue”);
b. if (amountOfRain > 5)
total += 5;
else
Doyle C#, 5th Edition Page 4
else
; // Note the null statement.
else
balance += transaction;
OR another solution would be: