COMP 230 WEEK 3 QUIZ SOLUTIONS
1. Question : (TCO 3) What statement best describes the following pseudocode?
if hoursWorked > 40 then
grossPay = 40 * rate + (hoursWorked - 40) * 1.5 * rate
else
grossPay = hoursWorked * rate
endif
Student Answer:
Dual-alternative selection
Case structure
Unary selection
If-then structure
Instructor See Chapter 2 in the textbook and the Week 3 lecture.
Explanation:
Points Received: 3 of 3
Comments:
1801333770 MultipleChoice 2 True
0 1801333770 MultipleChoice 2
2. Question : (TCO 3) What decision structure is logically equivalent to the following?
if customerCode not equal to 1 then
discount = 0.25
else
discount = 0.50
endif
Student Answer:
if customerCode > 1 then
discount = 0.50
else
discount = 0.25
endif
if customerCode = 1 then
discount = 0.50
else
discount = 0.25
endif
1. Question : (TCO 3) What statement best describes the following pseudocode?
if hoursWorked > 40 then
grossPay = 40 * rate + (hoursWorked - 40) * 1.5 * rate
else
grossPay = hoursWorked * rate
endif
Student Answer:
Dual-alternative selection
Case structure
Unary selection
If-then structure
Instructor See Chapter 2 in the textbook and the Week 3 lecture.
Explanation:
Points Received: 3 of 3
Comments:
1801333770 MultipleChoice 2 True
0 1801333770 MultipleChoice 2
2. Question : (TCO 3) What decision structure is logically equivalent to the following?
if customerCode not equal to 1 then
discount = 0.25
else
discount = 0.50
endif
Student Answer:
if customerCode > 1 then
discount = 0.50
else
discount = 0.25
endif
if customerCode = 1 then
discount = 0.50
else
discount = 0.25
endif