This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Session-Only System Variables”.
1. Which of these is a read only variable?
Explanation: The session only system variable ‘error_count’ is a read only variable that indicates the number of errors generated by the last statement that can generate errors. The others are writable.
2. Which variable when set to 1 would enable foreign key checking for InnoDB tables?
Explanation: Setting the variable ‘foreign_key_checks’ to 0 or 1 disables or enables the foreign key checking for InnoDB tables. The default is to perform checking. Disabling key checks can also be helpful.
3. The synonym for last_insert_id session variable is _____________
Explanation: The session only system variable ‘identity’ is a synonym for the ‘last_insert_id’ session variable. Setting ‘last_insert_id’ specifies the value to be returned by the function ‘LAST_INSERT_ID()’.
4. The string function that returns the index of the first occurrence of substring is _____________
Explanation: The string funtion ‘INSTR()’ is used to return the index of the first occurrence of the substring. The function ‘INSERT()’ is used to insert a substring at the specified position up to the specified number of characters.
5. What is the embedded server library containing the MySQL server linkable into applications?
Explanation: MySQL includes an embedded server library, libmysqld, containing the MySQL server in a way that can be linked into applications. This enables the production of MySQL-based standalone applications.
6. When building from source, the embedded server library is enabled by what?
Explanation: While building from the source, the embedded server library is enabled by using the option ‘–with-embedded-server’ while running ‘configure’. This applies equally to MySQL 5.0 and 5.1.
7. An embedded application includes the server side only.
Explanation: In MySQL, an embedded application includes both a client side and a server side, in order that it can process one group of options for the client, and another group for the server.
8. How many among the following use NULL to indicate failure?
Explanation: Both of the client library routines named ‘mysql_init()’ and ‘mysql_real_connect()’ return a pointer to the connection handler in order to indicate success and NULL to indicate failure.
9. How many among the following does not return a value?
mysql_close(), mysql_init, mysql_real_connect
Explanation: It is not necessary that every Application Programming Interface call would return a value. For example, the client routine named ‘mysql_close()’ returns void, that is, it does not return a value.
10. What returns a string containing an error message?
Explanation: The API call named ‘mysql_error()’ returns a string containing an error message. ‘mysql_close()’ does not return any value at all. ‘mysql_errno()’ returns a MySQL-specific numeric code.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.