TK Study

Past questions › hsc2025-q19

2025 3 marks Python / code Secure Software Architecture (Year 12) Developing secure code (Python)

NESA 2025 HSC Software Engineering exam (online) - Marking Guidelines

In an organisation, temporary passwords are automatically generated for new user accounts. Each password is created from the first three letters of the username followed by '123'. For example, the username 'NESA' will have the password 'NES123'. When a user logs in for the first time, they are asked for their username and password. They receive a welcome message or an error message, depending on whether the password entered follows the rules of new user accounts. Write a Python program that asks a new user for their username and password, and then checks whether the password rule has been followed. (3 marks)

Marking criteria

3: Correct code for the problem. 2: Partially correct code that includes a correct selection structure OR password creation. 1: Some understanding of the scenario and Python.

Sample answer

uName = input('What is your username?') password = input('What is your password?') passwordP1 = uName[:3] passwordP1= passwordP1 + '123' if passwordP1 == password: print ('Welcome!') else: print ('Incorrect password entered')

Question page · Practise and get marked