Документация
HTML CSS PHP PERL другое

Workshop

 
Previous Table of Contents Next

Workshop

Quiz

1:

Keys in hashes tied to DBM files can store keys with unlimited length.

  1. True

  2. False

2:

Why is it difficult to insert data into normal files?

  1. The surrounding data has to be moved to accommodate it.

  2. Normal files cannot be opened for reading and writing at the same time.

  3. The file must be locked while the file is being edited.

3:

Locking files is covered in which section of the FAQ?

Answers

A1:

b. The total combined length of a key and value in a DBM file is 1,024 characters, by default.

A2:

a. Data cannot easily be moved "up" and "down" within a file, so moving the surrounding data can be exceedingly difficult. Choice c is also true, but only when the file may be used by more than one program at a time.

A3:

Section 5, "Files and Formats."

Activities

  • Write a small program to update a counter in a file so that each time the program is run, the counter increases by 1. Remember to use locking in case multiple instances of your program are run at the same time.

    Previous Table of Contents Next
    © 2000- NIV