Robust and secure programming

EasyMediumHard
123456789101112131415161718
Question 3
Easy

A programmer is writing a system to validate the discount percentage applied to a checkout cart. The discount percentage must be an integer between 5 and 25 inclusive.

Below is the Python program used to perform this validation:

1  discount = int(input("Enter discount percentage: "))
2  while discount < 5 or discount > 25:
3      print("Invalid discount")
4      discount = int(input("Enter discount percentage: "))
5  print("Discount applied")

Complete the test plan in the table below to test the validation of discount.

Test numberTest typeTest dataExpected result
1Erroneous30(a)
2Boundary(b)"Discount applied"
3Normal12"Discount applied"

State the missing values for

a.

(a)

[1]
b.

(b)

[1]

Robust and secure programming Questions

  1. GCSE
  2. /Computer Science
  3. /Robust and secure programming