ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions
9 marks · Development process and analysis
Identify three processes that will be carried out by the program. Input(s) Username, password, gift card number Process(es) Output(s) Display new balance Using a programming language of your choice, write the input validation code to confirm that the password entered has five characters. Test data will be used to ensure this input validation works correctly. Complete the test table below. Type of test Input Expected result As4G5 Program will continue Exceptional Error message, ask to re‑enter A program is being written that will allow gamers to add money to their account using gift cards. gift card The program asks the user to enter their username, their five‑character password and the gift card number. The updated balance in the user’s account is then displayed.
• validate password length = 5 • validate gift card number • check username exists • check gift card number exists • check password entered is correct (matches user’s password) • calculate/update new balance Award 1 mark for each bullet. Maximum 3 marks. • conditional loop • correct loop condition always valid for password length = 5 • input assigned inside the loop • error message inside the loop Where candidate uses a post conditional loop the error message must be contained within a correct if statement. Where candidate does not use a loop, one mark may be awarded for the error message where attached conditions are correct. If the loop is missing the start/end of the loop assume that everything above or below the start/end is inside the loop. • normal/extreme • any value not 5 characters long