Storing data and records questions and answers
Questions
Q1. What is the difference between an integer and a real number?
Q2. What is a string?
Q3. Describe with an example how to convert a number into BCD.
Q4. Define a field and a record.
Q5. Define a file and a database.
Q6. Explain what a primary key is.
Q7. What is an ‘overhead’? Give examples to illustrate your answer.
Q8. Describe the seven steps needed to calculate the size of a file of fixed size records.
Q9. Explain how a file of variable length records is constructed.
Q10. State one advantage and one disadvantage of variable length records over fixed length records.
Answers
Q1. An integer is a whole number whereas a real number has a fractional part.
Q2. A string is made up of one or more characters from the keyboard.
Q3. Each digit is treated as a standalone nibble, with positions worth 8 4 2 and 1. So 58 is converted to the nibble for 5, which is 0101 and the nibble for 8, which is 1000. The BCD code for 58 is therefore 0101 1000.
Q4. A field is part of a record and is designed to hold a single data item of a specified type. A record is a collection of data items, which all relate to an actual entity.
Q5. A file is a collection of records. A database is a collection of one or more files.
Q6. A primary key is the one field in every record that will hold a unique value, not found in any of the other records. It is often a reference number such as a membership number, a National Insurance number, a pupil number and so on.
Q7. Overheads are pieces of information about the data e.g. when the data was created, last changed or if it is read only.
Q8. To work out the size of a file, you need to write down the fields in one record. You then allocate data types and the number of bytes allowed for each piece of data. You then work out the total size for one record. Then you work out the maximum size the file could ever be. You add an amount for overheads, usually 10%, and then put the answer into appropriate units, rounding the answer up or down. Finally, you put ‘approximately’ next to your answer. Remember, the answer must look like an approximation, not an exact calculation.
Q9. Variable sized records have a marker to separate each field and a marker to separate each record. This means that each record can have a different size because the markers can be used to find the start and finish of fields and records.
Q10. An advantage of variable length records is that they don’t waste any storage space. A disadvantage is that they are more complicated because you have to work out where fields and records start and stop.