Concept Description Code
Validation Automated checks to ensure reasonable data before acceptance.
- Range Check Verifies if a numerical value falls within specified upper and lower limits. number < 0 or number > 100
- Length Check Ensures data has a precise number of characters or a reasonable range of characters. if pin.length() > 5
- Type Check Verifies that the entered data corresponds to a specific data type. if number ≠ round(number)
[if the number isnt equal to rounded number]
- Presence Check Ensures that some data has been entered and not left blank. if input = “” [checks if nothing been put]
- Format Check Checks if the entered characters conform to a pre-defined pattern.
- Check Digit A calculated digit used for data integrity, often in codes like barcodes, ISBN, or VIN.
Verification Checking that data has been accurately copied from one source to another.
- Double Entry Data is inputted twice, and the system compares both entries for differences.
- Screen/Visual Check Users manually review entered data on the screen or paper document for accuracy.

Test Data - Eg. Of Entering Number

Normal normal data that would be entered — expected to be accepted — 2, 3, 4, 5
Abnormal weird data of different types and out of range — !@#$, two
Extreme the maximum and minimum values that will be accepted
Boundary the largest and smallest acceptable value is tested as well as the largest and smallest unacceptable value

Error Spotting -

  1. Variables initialized with incorrect numbers
  2. Variables being assigned to other variables backwards [h = x is wrong it should be x = h etc.]
  3. Statements not indented inside loop
  4. Statements inside loop when they shouldnt be there
  5. Incorrect use of > and <
Type of Iteration Description Loop Type
Count-controlled Loops Used when the number of iterations is known beforehand. Also known as a definite loop. FOR
Precondition Loops Used when the number of iterations is not known beforehand and depends on a condition. Also known as an indefinite loop. WHILE
Postcondition Loops Used when the loop must execute at least once, even if the condition is false initially. REPEAT-UNTIL

MAINTAINABLE PROGRAM -

  1. Meaningful identifiers
  2. Appropriate and Meaningful comments
  3. Good use of white space