[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-622904-en":3,"doc-seo-622904-105":31,"detail-sidebar-cat-0-en-105":96},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":21,"is_downloadable":21,"audit_status":21,"page_count":22,"language":23,"language_code":24,"site_id":25,"html_lang":24,"table_of_contents":26,"faqs":27,"seo_title":28,"seo_description":14,"update_tm":29,"read_time":30,"preview_page_count":4},622904,3985747858866,"jay","https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd",4,"Exam","Teaching guide - Data validation and authentication","Teaching guide focused on data validation and authentication in GCSE Computer Science. Explains why programmers must assume unreliable user input, and how validation improves robustness by checking feasibility such as format, length, and numeric range. Introduces different validation types—length checks, presence checks, and range checks—and clarifies limitations (validation may not verify correctness). Provides pseudo-code and worked examples across C#, Python, and VB.NET, including use of loops and messages when input is rejected.","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.  \nLearners 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 learner 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, learners 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 (such as a month between 1 and 12) .  \nFor GCSE, learners do not need to be able to check that data is of the correct type. In exam questions, learners 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 1.1  \nSeptember 2026  \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;  \ndo  \n{  \nConsole .Write (\"Enter password:\");  \npassword = Console .ReadLine();  \nif (password .Length \u003C 8)  \n{  \nConsole .WriteLine(\"Invalid input\");  \n}  \n} while (","cbCaieNbZP41N9kd","https://ap.wps.com/l/cbCaieNbZP41N9kd","pdf",225734,2,1,11,"English","en",105,"# Learning aims\n# Validation\n## Feasibility vs correctness\n# Different types of validation\n## Length checks\n## Presence checks\n## Range checks\n# Use of subroutines for validation\n# Authentication routines","[{\"question\":\"Why should programs involving user input include validation checks?\",\"answer\":\"Programs should assume users make mistakes and handle input accordingly. Validation reduces the chance of crashes or incorrect output by rejecting infeasible input before processing.\"},{\"question\":\"What does validation check, and what does it not check?\",\"answer\":\"Validation checks feasibility such as correct format or whether values fall within expected constraints. It does not verify that the data is actually correct, only that it is plausible.\"},{\"question\":\"What kinds of validation checks are required for GCSE learners?\",\"answer\":\"GCSE learners need simple checks such as length checks, presence checks (not empty), and range checks for numeric values within a defined boundary.\"}]","Teaching guide - Data validation and authentication | PDF",1792467290,28,{"code":4,"msg":32,"data":33},"ok",{"site_id":25,"language":24,"slug":34,"title":13,"keywords":35,"description":14,"schema_data":36,"social_meta":91,"head_meta":93,"extra_data":95,"updated_unix":29},"teaching-guide-data-validation-and-authentication","",{"@graph":37,"@context":90},[38,53,73],{"@type":39,"itemListElement":40},"BreadcrumbList",[41,45,48,51],{"item":42,"name":43,"@type":44,"position":21},"https://docshare.wps.com","Home","ListItem",{"item":46,"name":47,"@type":44,"position":20},"https://docshare.wps.com/document/","Document",{"item":49,"name":12,"@type":44,"position":50},"https://docshare.wps.com/document/exam/",3,{"item":52,"name":13,"@type":44,"position":11},"https://docshare.wps.com/document/teaching-guide-data-validation-and-authentication/622904/",{"url":52,"name":13,"@type":54,"image":55,"author":60,"headline":13,"publisher":62,"fileFormat":65,"inLanguage":24,"description":14,"dateModified":66,"datePublished":67,"encodingFormat":65,"isAccessibleForFree":68,"interactionStatistic":69},"DigitalDocument",{"url":56,"@type":57,"width":58,"height":59},"https://docshare.wps.com/thumbnails/teaching-guide-data-validation-and-authentication/622904.png","ImageObject",300,407,{"name":9,"@type":61},"Person",{"url":42,"name":63,"@type":64},"DocShare","Organization","application/pdf","2026-11-01","2026-10-20",true,{"@type":70,"interactionType":71,"userInteractionCount":20},"InteractionCounter",{"@type":72},"ViewAction",{"@type":74,"mainEntity":75},"FAQPage",[76,82,86],{"name":77,"@type":78,"acceptedAnswer":79},"Why should programs involving user input include validation checks?","Question",{"text":80,"@type":81},"Programs should assume users make mistakes and handle input accordingly. Validation reduces the chance of crashes or incorrect output by rejecting infeasible input before processing.","Answer",{"name":83,"@type":78,"acceptedAnswer":84},"What does validation check, and what does it not check?",{"text":85,"@type":81},"Validation checks feasibility such as correct format or whether values fall within expected constraints. It does not verify that the data is actually correct, only that it is plausible.",{"name":87,"@type":78,"acceptedAnswer":88},"What kinds of validation checks are required for GCSE learners?",{"text":89,"@type":81},"GCSE learners need simple checks such as length checks, presence checks (not empty), and range checks for numeric values within a defined boundary.","https://schema.org",{"og:url":52,"og:type":92,"og:title":13,"og:site_name":63,"og:description":14},"article",{"robots":94,"canonical":52},"index,follow",{"doc_id":7,"site_id":25},{"code":4,"msg":5,"data":97},[98,102,106,109,114,119,124,129,134,137,141],{"id":21,"doc_module":4,"doc_module_name":47,"category_name":99,"show_sort_weight":100,"slug":101},"Story & Novel",90,"story-novel",{"id":20,"doc_module":4,"doc_module_name":47,"category_name":103,"show_sort_weight":104,"slug":105},"Literature",80,"literature",{"id":11,"doc_module":4,"doc_module_name":47,"category_name":12,"show_sort_weight":107,"slug":108},70,"exam",{"id":110,"doc_module":4,"doc_module_name":47,"category_name":111,"show_sort_weight":112,"slug":113},5,"Comic",60,"comic",{"id":115,"doc_module":4,"doc_module_name":47,"category_name":116,"show_sort_weight":117,"slug":118},6,"Technology",50,"technology",{"id":120,"doc_module":4,"doc_module_name":47,"category_name":121,"show_sort_weight":122,"slug":123},7,"Healthcare",40,"healthcare",{"id":125,"doc_module":4,"doc_module_name":47,"category_name":126,"show_sort_weight":127,"slug":128},8,"Research & Report",30,"research-report",{"id":130,"doc_module":4,"doc_module_name":47,"category_name":131,"show_sort_weight":132,"slug":133},9,"Religion & Spirituality",20,"religion-spirituality",{"id":132,"doc_module":4,"doc_module_name":47,"category_name":135,"show_sort_weight":132,"slug":136},"World Cup","world-cup",{"id":138,"doc_module":4,"doc_module_name":47,"category_name":139,"show_sort_weight":138,"slug":140},10,"Lifestyle","lifestyle",{"id":142,"doc_module":4,"doc_module_name":47,"category_name":143,"show_sort_weight":110,"slug":144},19,"General","general"]