618 CHAPTER 16 Offline web applications
- Correct answer: B
A. Incorrect: An exception is thrown if a write action such as adding a new record is
performed by using a transaction in readonly mode.
B. Correct: Transactions must be in readwrite mode to add a new record.
C. Incorrect: If a transaction mode isn’t specified, it will default to readonly mode.
This would cause an exception to be thrown if an attempt to add a new record is
made.
D. Incorrect: There is no createTransaction function. - Correct answer: A
A. Correct: The get() method finds a specific value by using its key.
B. Incorrect: Object stores do not have a find() method.
C. Incorrect: Object stores do not have a single() method.
D. Incorrect: Object stores do not have a first() method.
Lesson 3
- Correct answer: D
A. Incorrect: LOW is not a valid file system mode.
B. Incorrect: Using PERSISTENT mode only will not allow the browser to remove files
if it begins running low in space.
C. Incorrect: SIMPLE is not a valid file system mode.
D. Correct: Using TEMPORARY mode allows the browser to remove files as space is
needed. - Correct answer: A
A. Correct: The seek() method moves the cursor to the given location, which in this
case will be the end of the file because you’re passing in the entire file length.
B. Incorrect: To find the end of the file, you should use the length property.
C. Incorrect: The FileWriter class does not contain a moveLast() method.
D. Incorrect: The FileWriter class does not contain a moveToEnd() method. - Correct answer: B
A. Incorrect: The remove method can be used only for directories that are empty. If a
file or subdirectory exists within a directorty, an error will be thrown.
B. Correct: The removeRecursively() method removes the directory and all files and
subdirectories below it.
C. Incorrect: The DirectoryEntry class does not have a removeAll() method.
D. Incorrect: The DirectoryEntry class does not have a remove() method.