AS6 Flashcards
(19 cards)
1
Q
Purpose and Structure of Files
A
- Files enable data to persist in storage between executions of a program.
- One file contains many records, structured as multiple fields.
2
Q
Fixed Length Record
A
- Every record has to be the same size, so the programmer needs to define the size at the start.
- Consider data types being stored and the max amount of bytes they will require.
- Easier to program, can calculate how much storage will be required.
3
Q
Variable Records
A
- More difficult to calculate space as a different number of bytes in each record.
- Slower to process by a computer as start/end locations need to be calculated at read/write time.
- No blank spaces are left.
- Each field can extend to accommodate characters, avoids truncation.
4
Q
Estimating File Size
A
- Singular record: Adding together the size of the individual fields.
- Final size: Multiply by number of records + 10%. (for metadata)
5
Q
File Access
A
- Normally provided by the core language or imported libraries.
- Files are processed by being read line by line. The file handler will contain a pointer to tell the handler where the last read/write operation occurred up until it reached an End Of File designator.
- Normal practice to close files once finished with them.
6
Q
Serial Files
A
- New records being appended to back of file is easiest storing method. Important that file is opened in append mode.
- Normally stored in chronological order.
- Used when number of records is small/data must stored in the order it arrived.
7
Q
Sequential File Access
A
- Will order records based on primary key field.
- One field will determine if order is ascending or descending. Makes searching easier.
- A requirement for implementing an index.
- Necessary to find correct position in the file to insert it. Harder than appening to serial files.
- Not possible to move records to make room for a new one, a temp file copies all records before, the new record, and then records after. Replaces original file.
8
Q
Indexed Sequential File Access
A
- Contains index which makes accessing record groups faster.
- Locates records in logical chunks e.g. starting with same letter.
- Speeds up searches, slows down insertion/deletion. When a record is added, the start and finish points of the index will change the size of one record.
- Access can still be slow for large amounts of records.
9
Q
Direct (random) File Access
A
- Jumping to a record without needing to perform a search/use an index.
- Can be implemented using a hashing algorithm (primary key taken and used to produce file position).
- DA files are split into blocks which contain a fixed number of records. The file will take up the same amount of space no matter amount of stored records.
10
Q
Overflow
A
- A collision is when a hashing algorithm returns the same block position for two keys.
- Each block has max record count, so it can fill up.
- Either create an overflow file can allow for excess records or create a new file containing more blocks and re-hash every excess record in the new file.
11
Q
Overflow v. File Re-Organisation
A
- Overflow area is lower in cost than a new file, can slow down searches.
- When a search reaches the end of the block, overflow will also be checked. Because both areas work in the same way, the file will be less efficient.
- Creating a new file and re-hashing could be expensive. This is used when the load factor is too high.
- Selecting a larger block size reduces the need.
12
Q
Generations of Files
A
- File backups can be created in a structure to allow a series of steps to be taken so that the system will be restored in steps depending on when the loss occurred.
- Grandfather (monthly), father (weekly), son (daily).
13
Q
Transaction Logs
A
- Maintain the security of the system by giving accountability/ allowing file changes to be tracked.
14
Q
Master and Transaction Files
A
- To back up files with vast amounts of data, two files are used: A transaction file (short term interactions), and a master file (all data).
- Transaction files act as a temp file, holding data for a short period of time, to keep the system running quickly. At the end of a period, the data is copied to the master file.
- The master file stores all the data so they wont be used to carry out day-to-day operations (too large). Used for batch processing.
15
Q
Field
A
- To store data, it needs to be organised in fields.
- Each field represents a piece of data.
16
Q
Backup
A
- Copying files from their main area of use to a seperate area of use.
- If a file is data, the backup can be accessed to retrieve lost data.
17
Q
Archiving
A
- Files build up and take space. The more of space used up, the slower the computer.
- Files not used day-to-day could be archived.
- Moved to a seperate archive system, will speed up the overall performance of the system while still giving access to files if need arrives.
18
Q
Validation
A
- Ensures data entered is valid. Done through checks.
19
Q
Verification
A
- Ensures data entered is correct. Managable but often not wholly achievable.
- Proofreading: Compare original document to what has been keyed in.
- Double entry: Have data keyed in twice, allowing computer to identify any differences in the two versions.