[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-622783-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-622783-en":130},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","teaching-guide-data-validation-and-authentication-gcse-computer-science","Teaching guide - Data validation and authentication - GCSE Computer Science","","Teaching guide focused on secure, robust programming through data validation and authentication. Explains why user input must be treated as inherently unreliable, and how validation improves resilience by checking feasibility such as format, length, and allowed ranges. Covers key validation types for GCSE Computer Science, including length checks, presence and range checks, plus the use of iteration and boolean control. Introduces simple authentication routines and provides pseudo-code and examples in C#, Python, and VB.NET.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/exam/","Exam",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/teaching-guide-data-validation-and-authentication-gcse-computer-science/622783/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/teaching-guide-data-validation-and-authentication-gcse-computer-science/622783.png","ImageObject",300,407,{"name":42,"@type":43},"Indoniesian Boy","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-06","2026-10-20",true,{"@type":52,"interactionType":53,"userInteractionCount":26},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"Why should programs validate user input?","Question",{"text":62,"@type":63},"Programs should assume users will make mistakes and therefore validate input before continuing. Validation reduces the risk of crashes or incorrect output and makes programs more robust.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"What does validation check, and what does it not check?",{"text":67,"@type":63},"Validation checks that input is feasible, such as having the correct format or being within an allowed range. It does not guarantee the data is factually correct.",{"name":69,"@type":60,"acceptedAnswer":70},"Which validation checks are required at GCSE level?",{"text":71,"@type":63},"Students need simple checks such as length checks, presence checks, and range checks for values like months between 1 and 12. At GCSE level, checking the correct data type is not required.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},622783,1792467074,{"code":4,"msg":81,"data":82},"success",[83,87,91,94,99,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":92,"slug":93},70,"exam",{"id":95,"doc_module":4,"doc_module_name":25,"category_name":96,"show_sort_weight":97,"slug":98},5,"Comic",60,"comic",{"id":100,"doc_module":4,"doc_module_name":25,"category_name":101,"show_sort_weight":102,"slug":103},6,"Technology",50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":95,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":33,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":26,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":79,"read_time":112,"preview_page_count":4},962090760608,"https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c","Teaching guide: Data validation and authentication  \nThis resource will help with understanding robust and secure programming. It supports elements of section 3.2.11 of our GCSE Computer Science specification (8525) . The guide is designed to address the following learning aims:  \n• Recognise the inherent unreliability of data entered by a user.  \n• Investigate ways to validate data using code.  \n• Be able to write simple authentication routines.  \nValidation  \nWhen writing programs that involve user input, a programmer should assume that the user will make mistakes when entering data and write their programs accordingly.  \nCode can be written that validates the user’s input before carrying on. Adding validation to program code can help to reduce the likelihood of incorrect user input causing a program to crash or produce incorrect output, thereby making a program more robust.  \nStudents should be aware that validation only checks that input data is feasible, such as being in the correct format. It does not check that the data is correct. For example, validation could not detect the input of a test percentage of 56 when a student scored 65 as both are feasible marks, but it could reject a mark of 566 which is not feasible.  \nDifferent types of validation  \nFor GCSE, students need to be able to perform simple validation checks such as:  \n• length check: checking if an entered string has a minimum length  \n• presence check: checking that a string is not empty  \n• range check: checking if numeric data entered lies within a given range (e.g. a month between 1 and 12) .  \nFor GCSE, students do not need to be able to check that data is of the correct type. In exam questions, students can assume that any errors relating to user input will not relate to data type.  \nContents  \n\n| Section | Page |\n| --- | --- |\n| Length checks | 3 |\n| Range checks | 5 |\n| Use of subroutines for validation | 7 |\n| Authentication routines | 9 |\n\nVersion 2.0  \nSeptember 2025  \nLength checks  \nA length check typically checks that an entered value contains a certain minimum number of characters but could also check that the value does not exceed a maximum number of characters.  \nValidation is usually implemented using indefinite iteration. This can be achieved using a pre-conditioned or post-conditioned loop. The table below shows pseudo-code for a length check using post-conditioned and pre-conditioned loops.  \nGood validation checks will output a message to inform the user if their input has been rejected, but this is not always required (and might not be in an exam question that has a low number of marks allocated to it) .  \n\n| Pseudo-code for simple length check without error message |  |\n| --- | --- |\n| Post-conditioned loop | Pre-conditioned loop |\n| REPEAT\u003Cbr>OUTPUT 'Enter password'password ← USERINPUT UNTIL LEN(password) ≥ 8 | OUTPUT 'Enter password'password ← USERINPUT WHILE LEN(password) \u003C 8\u003Cbr>OUTPUT 'Enter password'password ← USERINPUT |\n| Pseudo-code for simple length check with error message |  |\n| Post-conditioned loop | Pre-conditioned loop |\n| REPEAT\u003Cbr>OUTPUT 'Enter password:'password ← USERINPUT\u003Cbr>IF LEN(password) \u003C 8 THEN\u003Cbr>OUTPUT 'Invalid input'ENDIF\u003Cbr>UNTIL LEN(password) ≥ 8 | OUTPUT 'Enter password:'password ← USERINPUT\u003Cbr>WHILE LEN(password) \u003C 8 OUTPUT 'Invalid input'OUTPUT 'Enter password:'password ← USERINPUT |\n\nUsing a post-conditioned loop generally requires less code when an error message does not need to be output, but the amount of code required is similar whichever approach is taken when an error message is displayed as part of the validation check. C\\# and VB.NET support both pre-conditioned and post-conditioned loops but Python only supports pre-conditioned loops.  \nExamples of length checks implemented in C\\#, Python and VB.NET.  \nC\\#  \nstring password; do  \n{  \nConsole .Write(\"Enter password:\");  \npassword = Console .ReadLine();  \nif (password .Length \u003C 8)  \n{  \nConsole .WriteLine(\"Invalid input\");}  \n} while (password","cbCaig6YoSMup0W0","https://ap.wps.com/l/cbCaig6YoSMup0W0","pdf",246690,12,"English","# Validation\n## Different types of validation\n## Contents\n# Length checks\n## Pseudo-code examples\n# Range checks\n## Boolean control for loops\n# Use of subroutines for validation\n# Authentication routines","[{\"question\":\"Why should programs validate user input?\",\"answer\":\"Programs should assume users will make mistakes and therefore validate input before continuing. Validation reduces the risk of crashes or incorrect output and makes programs more robust.\"},{\"question\":\"What does validation check, and what does it not check?\",\"answer\":\"Validation checks that input is feasible, such as having the correct format or being within an allowed range. It does not guarantee the data is factually correct.\"},{\"question\":\"Which validation checks are required at GCSE level?\",\"answer\":\"Students need simple checks such as length checks, presence checks, and range checks for values like months between 1 and 12. At GCSE level, checking the correct data type is not required.\"}]","Teaching guide - Data validation and authentication - GCSE Computer Science | PDF"]