1.2bFree
Your guide: Miss HiraExplains computers with chai, cricket and your phone.
On exam day, 500 students look for their seats. One hall lists names in the order forms arrived: you read down until you find yours. Another hall seats you by roll number: roll 457 walks straight to seat 457.
Files on a disk face the same choice. How records are placed decides how much work it takes to find one of them.
Step 1 / 7
On exam day, 500 students look for their seats. One hall lists names in the order forms arrived: you read down until you find yours. Another hall seats you by roll number: roll 457 walks straight to seat 457.
Files on a disk face the same choice. How records are placed decides how much work it takes to find one of them.
From the storage point of view there are three organizations. Sequential files are stored one after another and take the most processing time. Direct or random files sit at an address calculated from the key field. Indexed sequential files keep a separate index of keys and addresses: sequential or random access, but more space.
Q1. A record's address is key mod 50. Find the addresses of keys 0342 and 0288.
42, 38
Q2. With the same rule, show that keys 0157 and 0457 are synonyms.
Both map to address 7: synonyms
Q3. A college prints all 1,200 result cards once a year, and also answers single-student queries at the counter. Which organization suits both jobs?
Indexed sequential
✗ Saying records in a random file are stored in no particular place.
✓ Each record sits at an address calculated from its key field. Random means it can be reached directly, in any order.
✗ Defining a synonym as two records with the same key.
✓ Synonyms have different keys that produce the same calculated address, like 0157 and 0457 giving 7.
✗ Thinking indexed sequential files are better in every way.
✓ They pay for speed with space: the index of keys and addresses needs relatively more storage.
1. Which type of file requires the largest processing time?
(a) Records must be read one after another until the wanted one is reached.
2. In a direct file, a record's location is calculated from:
(b) The address is calculated against the value of the key field.
3. With address = key mod 50, which key is a synonym of 0203?
(b) 203 mod 50 = 3 and 253 mod 50 = 3: same address, different keys.
4. Which files can be processed both sequentially and randomly?
(c) The separate index gives direct access, and the records can still be read in sequence.
5. The drawback of indexed sequential files is that they:
(b) Storing the index needs relatively more space, though processing is as fast as random files.