SY0-301 · Question #51
Which of the following is the below pseudo-code an example of? IF VARIABLE (CONTAINS NUMBERS = TRUE) THEN EXIT
The correct answer is B. Input validation. The pseudocode inspects a variable for numeric content before allowing execution to continue, which is a textbook example of input validation.
Question
Which of the following is the below pseudo-code an example of? IF VARIABLE (CONTAINS NUMBERS = TRUE) THEN EXIT
Options
- ABuffer overflow prevention
- BInput validation
- CCSRF prevention
- DCross-site scripting prevention
How the community answered
(27 responses)- A7% (2)
- B85% (23)
- C4% (1)
- D4% (1)
Why each option
The pseudocode inspects a variable for numeric content before allowing execution to continue, which is a textbook example of input validation.
Buffer overflow prevention focuses on enforcing memory boundary limits on input length, not on checking the data type or content of a variable.
Input validation is the practice of checking data against expected formats, types, or ranges before processing it. The pseudocode explicitly tests whether a variable contains numbers and exits if that condition is met, preventing undesired input from propagating through the system - a direct implementation of an input validation gate.
CSRF prevention uses techniques such as synchronizer tokens or SameSite cookies to stop unauthorized cross-site requests, which has no relation to variable content inspection.
XSS prevention involves encoding or sanitizing output rendered in a browser to block injected scripts, not checking whether a variable contains numeric characters.
Concept tested: Input validation to reject unwanted data types
Source: https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html
Topics
Community Discussion
No community discussion yet for this question.