This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Compound Statement Syntax”.
1. The statement that constructs a branching flow-control construct is _____________
Explanation: The ‘CASE’ statement provides a branching flow-control construct. When the initial expression, ‘expr’, is present, CASE compares it to the expression following each ‘WHEN’.
2. Which statement terminates the execution of a function?
Explanation: The ‘RETURN’ statement is used only within stored functions, not stored procedures, triggers, or events. When this statement is executed it terminates execution of the function.
3. Association between one or more MyISAM tables and the named key cache is set by _____________
b) CACHE INDEX
c) ALTER DATABASE
d) ALTER EVENT
Explanation: ‘CACHE INDEX’ sets up an association between one or more MyISAM tables and the named key cache which must already exist. The INDEX privilege is needed for each table named in the statement.
4. Which statement exits a labeled flow-control construct?
Explanation: The ‘LEAVE’ statement is used to exit a labeled flow-control construct. This statement must appear within the construct that has the given label. The syntax of the statement is ‘LEAVE label’.
5. What enables encrypted connections to be established?
Explanation: For the ‘exec_stmt_ssl’ to work properly, MySQL must have been built with SSL support, and the server must be started with the proper options that identify its certificate and key files.
6. What is the exec_stmt_ssl written in?
Explanation: In MySQL, the ‘sampdb’ distribution contains a source file named ‘exec_stmt_ssl.c’ from which the client program ‘exec_stmt_ssl’ can be built. There is a procedure to build this file.
7. What does ‘mysql_query()’ return on failure?
d) a non-zero value
Explanation: Both of the functions named ‘mysql_query()’ and ‘mysql_real_query()’ return zero for statements that succeed. They return non zero for failure. A statement is successfully executed if the server accepts it.
8. When linking to a static MySQL C client library, the client library and the client application can use different compiler options.
Explanation: Generally, when linking to a static MySQL C client library, the client library and the client application must use the same compiler option when it is required to link the C runtime.
9. What can be used in place of MYSQL_SERVER_VERSION?
Explanation: The macros ‘LIBMYSQL_VERSION’ and ‘LIBMYSQL_VERSION_ID’ have the same values as ‘MYSQL_SERVER_VERSION’ and ‘MYSQL_VERSION_ID’ and the two sets of macros can be used in place of each other.
10. What can be used interchangeably with MYSQL_VERSION_ID?
Explanation: The ‘LIBMYSQL_VERSION’ and ‘LIBMYSQL_VERSION_ID’ macros have the same values as ‘MYSQL_SERVER_VERSION’ and ‘MYSQL_VERSION_ID’ and the two sets of macros can be used interchangeably.
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.