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?
a) error_count
b) big_tables
c) autocommit
d) foreign_key_checks
View Answer
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?
a) error_count
b) identity
c) foreign_key_checks
d) autocommit
View Answer
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 _____________
a) insert_id
b) identity
c) sql_auto_is_null
d) sql_big_selects
View Answer
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. When building from source, the embedded server library is enabled by what?
a) –with-embedded-server
b) –with-server-embedded
c) –with-embedded-library
d) –with-library-embedded
View Answer
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.
5. How many among the following use NULL to indicate failure?
mysql_init(), mysql_real_connect()
a) 0
b) 1
c) 2
d) 3
View Answer
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.
6. How many among the following does not return a value?
mysql_close(), mysql_init, mysql_real_connect
a) 0
b) 1
c) 2
d) 3
View Answer
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.
7. What returns a string containing an error message?
a) mysql_error()
b) mysql_errno()
c) mysql_sqlstate()
d) mysql_close()
View Answer
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.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Check Information Technology Books
- Practice Programming MCQs
- Apply for Programming Internship
- Check MySQL Books