Name:     ID: 
 
    Email: 

Chapter 5 Programming Logic and Design

Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
 

 1. 

What pseudocode is used in a binary selection?
a.
if-then
c.
while
b.
if-then-else
d.
do-while
 

 2. 

What statement best describes the following pseudocode:
if hoursWorked > 40 then
    grossPay = 40 * rate + (hoursWorked - 40) * 1.5 * rate
else
    grossPay = hoursWorked * rate
endif
a.
dual-alternative selection
c.
case structure
b.
unary selection
d.
if-then structure
 

 3. 

Which keyword is not included in a single-alternative selection?
a.
if
c.
else
b.
then
d.
endif
 

 4. 

Which pseudocode produces the same result as the following:
if customerAge >= 65 then
    discount = 0.10
else
    discount = 0
endif
a.
if customerAge > 65 then
    discount = 0.10
else
    discount = 0
endif
c.
if customerAge > 65 then
    discount = 0
else
    discount = 0.10
endif
b.
if customerAge < 65 then
    discount = 0.10
else
    discount = 0
endif
d.
if customerAge < 65 then
    discount = 0
else
    discount = 0.10
endif
 

 5. 

Assume that out of 1000 employees, 900 employees in the company have medical insurance and 500 have dental insurance.  How many times will the following decision structures be executed in total?
if empDentalIns = “Y” then
    if empMedicalIns = “Y” then
         print empIdNumber, empLastName, empFirstName
    endif
endif
a.
500
c.
1500
b.
900
d.
1900
 

 6. 

What produces the same result as the following pseudocode?
if empRate >= 10.00 then
    if empRate < 12.00 then
        print empIdNumber, empLastName, empFirstName
    endif
endif
a.
if empRate >= 10.00 AND < 12.00 then
    print empIdNumber, empLastName, empFirstName
endif
b.
if empRate >= 10.00 AND empRate < 12.00 then
    print empIdNumber, empLastName, empFirstName
endif
c.
if empRate <= 10.00 AND empRate < 12.00 then
    print empIdNumber, empLastName, empFirstName
endif
d.
if empRate < 10.00 AND > 12.00 then
    print empIdNumber, empLastName, empFirstName
endif
 

 7. 

If a movie theater manager says, “Provide a discount to patrons who are under 13 years old and those who are over 64 years old; otherwise, charge the full price.”  Which statement is correct to implement this logic?
a.
if patronAge < 13 AND patronAge > 64 then
    price = discountPrice
else
    price = fullPrice
endif
b.
if patronAge > 13 AND patronAge < 64 then
    price = discountPrice
else
    price = fullPrice
endif
c.
if patronAge < 13 OR patronAge > 64 then
    price = discountPrice
else
    price = fullPrice
endif
d.
if patronAge > 13 OR patronAge < 64 then
    price = discountPrice
else
    price = fullPrice
endif
 



 
Submit          Reset Help