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 _____________
a) BEGIN…END
b) CASE
c) ITERATE
d) LEAVE
View Answer
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?
a) BEGIN…END
b) RETURN
c) ITERATE
d) LOOP
View Answer
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 _____________
a) BEGIN
b) CACHE INDEX
c) ALTER DATABASE
d) ALTER EVENT
View Answer
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?
a) DESCRIBE
b) LEAVE
c) LOOP
d) RETURN
View Answer
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 is the exec_stmt_ssl written in?
a) C++
b) C
c) Python
d) Perl
View Answer
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.
6. What does ‘mysql_query()’ return on failure?
a) 0
b) 1
c) -1
d) a non-zero value
View Answer
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.
7. When linking to a static MySQL C client library, the client library and the client application can use different compiler options.
a) True
b) False
View Answer
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.
8. What can be used in place of MYSQL_SERVER_VERSION?
a) LIBMYSQL_VERSION
b) LIBMYSQL_VERSION_ID
c) MYSQL_VERSION_ID
d) MYSQL_ID
View Answer
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.
9. What can be used interchangeably with MYSQL_VERSION_ID?
a) LIBMYSQL_VERSION
b) LIBMYSQL_VERSION_ID
c) MYSQL_VERSION_ID
d) MYSQL_ID
View Answer
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.
- Practice Programming MCQs
- Check MySQL Books
- Apply for Programming Internship
- Check Information Technology Books