Code Maintainability Q&A

Question 1[4 marks]



The two Python scripts above were created by an IT manager of a school and are performing exactly the same task: to generate a username based on the student’s firstname, lastname and year group. Compare both of these scripts and identify what was done to the code to make it easier to understand, maintain and re-use in future projects?




Question 2[2 marks]

The IT manager would like to make this program more robust by adding a validation check on the year group. The school only has students in year 7 to year 13. How could the IT manager change the code above to make sure the user can only enter a value between 7 and 13 for the year group?




Question 3[4 marks]

The IT manager would like test his new validation check on the year group. Identify 4 pieces of test data that the IT manager should use to perform a normal/valid test, an invalid test, a boundary test and an erroneous test?

Normal/Valid Test Data:
Invalid Test Data:
Boundary Test Data:
Erroneous Test Data:



Did you like this challenge?

Click on a star to rate it!

Average rating 3.7 / 5. Vote count: 46

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!