250+ TOP MCQs on Session-Only System Variables and Answers

MySQL Database Multiple Choice Questions 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

Answer: a
Clarification: 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

Answer: c
Clarification: 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

Answer: b
Clarification: 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

Answer: a
Clarification: 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

Answer: c
Clarification: 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

  250+ TOP MCQs on MySQL Datatypes and Answers

Answer: b
Clarification: 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()

Answer: a
Clarification: 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.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top