MySQL Questions and Answers – Database Maintenance, Backups and Replication

This set of Tricky MySQL Questions and Answers focuses on “Database Maintenance, Backups and Replication”.

1. For InnoDB tables in mysqldump an online backup that takes no locks on tables can be performed by ______________
a) –multiple-transaction
b) –single-transaction
c) –double-transaction
d) –no-transaction
View Answer

Answer: b
Explanation: For InnoDB tables it is possible to perform an online backup that takes no locks on tables using the option ‘–single-transaction’ to ‘mysqldump’. The ‘mysqldump’ can make backups.

2. To reload a delimited text data file use ______________
a) mysqldump
b) mysqld
c) mysqlimport
d) mysqlnaive
View Answer

Answer: c
Explanation: A way to create text data files along with files containing ‘CREATE TABLE’ statements for the backed up tables is to use ‘mysqldump’ with –tab. To reload a delimited text data file ‘mysqlimport’ is used.

3. Replication enables data from one MySQL database server to be copied to one or more MySQL database servers.
a) True
b) False
View Answer

Answer: a
Explanation: Replication enables data from one MySQL database server (the master) to be copied to one or more MySQL database servers (the slaves). Replication is asynchronous by default.
advertisement
advertisement

4. SBR replication is ______________
a) Statement based
b) Row based
c) Column based
d) Table based
View Answer

Answer: a
Explanation: There are two main kinds of replication format: Statement Based Replication (SBR) replicates entire SQL statements and Row Based Replication (RBR) replicates only the changed rows.

5. The library file that contains various portability macros and definitions is ______________
a) my_global.h
b) my_sys.h
c) mysql.h
d) my_local.h
View Answer

Answer: b
Explanation: The ‘my_sys.h’ header file contains a variety of portability macros and definitions required for structures and functions. These structures and functions are used by the client library.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. The header that should be included first is ______________
a) my_global.h
b) my_sys.h
c) mysql.h
d) my_local.h
View Answer

Answer: a
Explanation: The file ‘my_global.h’ takes care of including several other header files that are likely to be generally useful, like ‘stdio.h’. It also includes Windows compatibility information.

7. Which of the following use ‘NULL’ to indicate failure?

advertisement
mysql_init(), mysql_real_connect()

a) 0
b) 1
c) 2
d) 3
View Answer

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

8. Which of the following does not return a value?

mysql_close(), mysql_init, mysql_real_connect

a) 0
b) 1
c) 2
d) 3
View Answer

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

9. What is the general statement-issuing routine?
a) mysql_real_query()
b) mysql_query_real()
c) mysql_image_query()
d) mysql_query_image()
View Answer

Answer: a
Explanation: The general statement-issuing routine is mysql_real_query(). The statement is provided as a counted string (a string plus a length). The length of the statement string must be kept track of.

10. The most restrictive among the following is ______________

mysql_query(), mysql_real_query()

a) mysql_query()
b) mysql_real_query()
c) same
d) machine dependent
View Answer

Answer: a
Explanation: The statement-issuing function other than ‘mysql_real_query()’ is ‘mysql_query()’. It is more restrictive in what it allows in the statement string although it is often easier to use.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice tricky questions and answers on all areas of MySQL, 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.