Test Series - html

Test Number 42/72

Q: Which function is used to return a handle to the database?
A. prepareDatabase()
B. showDocCount()
C. executeSql()
D. openDatabase()
Solution: prepareDatabase() function is used to return a handle to database. It is necessary to first create the database. showDocCount() shows the real work after creating the database. Syntax of calling a JavaScript function is: function prepareDatabase(ready, error).
Q: openDatabase() method does not take the argument in __________
A. database name
B. display name
C. database version
D. server name
Solution: openDatabase() and openDatabaseSync() methods takes the name of the database, version of the database, display name, estimated size in bytes of the data that is to be stored in the database. openDtabase() method works on WorkerUtils and Window, openDatabaseSync() method works on WorkerUtils.
Q: The sign is used for the placeholder _____________
A. &
B. *
C. ^
D. ?
Solution: ‘?’ is used for the placeholder. Binding of the ? placeholder is done at a literal level. It is dynamically inserted into the statement. ‘?’ can be used in place of literals in SQL statements. If this character is not supported then the error code 5 is invoked.
Q: Which feature is not used when SQL features are not being supported?
A. BEGIN
B. END
C. COMMIT
D. ROLLBACK
Solution: When SQL feature is not supported then we use COMMIT, BEGIN, ROLLBACK SQL features and are marked as bogus. User agent uses the statements that contain these three words in case of failure of the support of SQL features.
Q: transaction() does not take the argument _______
A. callback
B. success callback
C. error callback
D. database name
Solution: transction() and readTransaction() are the two methods that take three arguments i.e. transaction callback as the first argument, error callback as the second argument, success callback as the third argument.
Q: Which method is used to verifythe version number?
A. changeVersion()
B. readTransaction()
C. transaction()
D. executeSql()
Solution: changeVersion() method automatically verify version number and it also changes it like doing a schema update. When this method is invoked it immediately returns and then run transaction steps asynchronously by taking transaction callback as the third argument, error callback as the fourth argument and success callback as the fifth argument.
Q: Which error is invoked when SQLTransactionCallback does not execute?
A. INVALID_ACCESS_ERR
B. UNKNOWN_ERR
C. TIMEOUT_ERR
D. INVALID_STATE_ERR
Solution: When SQLTransactionCallback, SQLStatementErrorCallback, SQLStatementCallback does not execute then INVALID_STATE_ERR error is raised. This error is raised from inside a SQLTransactionErrorCallback.
Q: Which object is created for read-only transaction?
A. Foo object
B. SQLTransactionSync
C. DatabaseSync object
D. SQLTransaction
Solution: For read-only transaction, we create the object SQLTransactionSync. If the first argument is NULL then we throw SQLException which is Error code 0. SQLTransactionSync object is fresh initially but when it is marked as stale it is committed or rolled back.
Q: insertId attribute returns ____________
A. column ID
B. row ID
C. user’s ID
D. database ID
Solution: insertId attribute returns the row ID of the row of the inserted SQLResultSet object’s SQL statement that is inserted into the database. If multiple rows are inserted then the ID of the last row will be returned. If there is no row then INVALID_ACCESS_ERR exception will be raised.
Q: Number of rows is returned by the attribute __________
A. insertIID
B. rows
C. rowsAffected
D. length
Solution: rowsAffected attribute returns the number of rows that were changed by SQL. If there is no change by the SQL statement then this attribute will return zero. If we use “SELECT” statement, this attribute will always return zero.

You Have Score    /10