Unit 2 Flashcards
What is a data type?
The kind of values that can be used in a data item
what is an arithmetic operator?
a symbol that will perform an operation on numbers
Examples of data types
- Integer
- Float/Real
- Character
- String
- Boolean
Examples of arithmetic operators
+, -, *, /, ^, MOD, DIV
what is a range check?
ensuring that a number or date is within a sensible/allowed range
what is a type check?
ensuring that data is of the right type, such as integer, letter or text
Length check
Text entered is not too long or too short - for example, a password is between 8 and 15 characters
Presence check
Checks that data has been entered i.e. the field has not been left blank
Format check
Checks that the format of, for example, a postcode or email address is correct
Validation vs Verification
- Validation can only check that the data entered is reasonable
- Verification is used to double-check that the data has been typed in correctly
Double-entry verification
- A user setting up a new password may be asked to type it in twice
- If the two passwords don’t match, they will be asked to enter the password again
- This is known as double-entry verification
Authentication routines and an example
- Are used to make sure a person is who they claim to be
- Commonly, you are asked to enter a user ID and a password
- Once you have the entered user ID, the website looks up your password in the database
- If the user ID cannot be found, an error message is displayed
- You usually get three attempts to get your password and then you are locked out
Syntax errors
- A syntax error is one where the code written doesn’t conform to the rules of the language
- The compiler doesn’t know how to translate the program into machine code so will give the programmer a syntax error
- The program cannot be run until all syntax errors are fixed
Examples of syntax errors
- missing a symbol
- misspelling a word
- mixing up capitalisation in variable names
Logic errors
Logic errors are from a misunderstanding of what the code is doing - the code will still run, but have unexpected outcomes
- using the wrong Boolean statement (e.g. OR instead of AND)
- using the wrong data type
- writing statements in the wrong sequence