MySQL Questions and Answers – Compound Statement Syntax

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

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

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

Answer: b
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.
advertisement
advertisement

4. Which statement exits a labeled flow-control construct?
a) DESCRIBE
b) LEAVE
c) LOOP
d) RETURN
View Answer

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

Answer: b
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.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What does ‘mysql_query()’ return on failure?
a) 0
b) 1
c) -1
d) a non-zero value
View Answer

Answer: d
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

Answer: b
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.
advertisement

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

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

Answer: b
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.
advertisement

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]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.