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 ______________
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 ______________
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.
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.
4. SBR replication is ______________
a) Statement based
b) Row based
c) Column based
d) Table based
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 ______________
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.
6. The header that should be included first is ______________
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?
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.
8. Which of the following does not return a value?
mysql_close(), mysql_init, mysql_real_connect
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?
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 ______________
d) machine dependent
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.