Question 6

How many test cases need to be designed to achieve 100% decision coverage in the following piece of pseudo-code which applies discount rates to hotel room bookings?
Read (Loyalty_level)
Read (Room_price)
IF (Room_price > 200)
IF (Loyalty_level = Platinum)
Discount_factor = 80%
ELSE
IF (Loyalty_level = Gold)
Discount_factor = 85%
ELSE
Discount_factor = 95%
ENDIF
ENDIF
ELSE
IF (Room_price > 150)
IF (Loyalty_level = Platinum)
Discount_factor = 85%
ELSE
Discount_factor = 95%
ENDIF
ELSE
Discount_factor = 100%
ENDIF
ENDIF
Room_price = Room_price * Discount_factor
IF (Discount_factor < 100%)
Show message "Congratulations - you have received a discount!"
ENDIF
  • Question 7

    You have been assigned to perform a review on code provided below:

    Which type of defect should you report as part of the code review?
  • Question 8

    You have been assigned to perform a review on code provided below:

    Which type of defect should you report as part of the code review?
  • Question 9

    Which statement is correct with respect to fault injection tools?
  • Question 10

    Given the following pseudo code for a program to solve quadratic equations:
    program Quadratic Formula
    integer: a, b, c, d
    floating point: r1, r2
    READ (a)
    READ (b)
    READ (c)
    d := (b * b) - (4 * a * c)
    IF d < 0 THEN
    PRINT ("Imaginary Roots")
    ELSE
    r1 := (-b + sqrt(d)) / (2 * a)
    r2 := (-b - sqrt(d)) / (2 * a)
    PRINT ("first root is: " r1)
    PRINT ("second root is: " r2)
    ENDIF
    END program Quadratic_Formula
    Which of the following checklist items is MOST likely to indicate a problem in this program?