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
Trace tables
- Used for tracking the outputs of a program, and the values of each variable used in a program
- They are useful for for finding logical errors
What is an array?
- An array is a data structure that allows you to hold many items of data which is referenced by one identifier
- All items of data in the array must be of the same data type
- Has a fixed length
What is a record?
A data structure consisting of a number of fields which can all be of different types
What is a subroutine?
A small subsection of the whole program that performs a specific, well-defined task
Parameter
A piece of data that is passed into a subroutine in order for that subroutine to do its job
Calling
A process where an instruction in one part of the code tells another named part of the code to run
Modularisation
The process of breaking a program into smaller parts called modules. A subroutine is a type of module.
Return
A command in which a subroutine passes a piece of data back to the line of code from which it was called
Authentication
The software process of ensuring that the person accessing a system is the person who is supposed to access that system. The following might be used:
- Usernames and passwords
- Memorable information - prompting for something only the real user should know, such as favourite place or the name of a first pet
- Checking that the user is using their usual computer