This set of MySQL Multiple Choice Questions & Answers focuses on “Performing Database Maintenance with the Server Running”.
1. To perform consistency checks on a MyISAM table the statement is _____________
a) CHECK TABLE
b) REPAIR TABLE
c) ANALYZE TABLE
d) OPTIMIZE TABLE
Explanation: In order to perform consistency checks or table repairs on a MyISAM table a ‘CHECK TABLE’ or ‘REPAIR TABLE’ statement is issued. The ‘mysqlcheck’ program can also be invoked.
2. The statement that performs key distribution analysis and stores the distribution for the named tables is _____________
a) CHECK TABLE
b) ANALYZE TABLE
c) CHECKSUM TABLE
d) OPTIMIZE TABLE
Explanation: ‘ANALYZE TABLE’ performs a key distribution analysis and stores the distribution for the named table or tables. For the MyISAM tables, this statement is equivalent to using ‘myisamchk –analyze’.
3. The column not returned by ‘OPTIMIZE TABLE’ is _____________
Explanation: ‘OPTIMIZE TABLE’ table catches and throws any errors that occur while copying table statistics from the old file to the newly created file. It returns a result set of columns.
4. For which table does ‘REPAIR TABLE’ not work?
Explanation: ‘REPAIR TABLE’ works for MyISAM, ARCHIVE, and CSV tables. For MyISAM tables, it has the same effect as ‘myisamchk –recover’ tbl_name by default. This statement does not work with views.
5. What is the Perl DBI?
a) database inheritance
b) database integrity
c) database interface
d) database isolation
Explanation: The Perl DBI is the Perl Database Interface. The work of the interface is to form a link between the application programming interface in C with all the other programming languages.
6. What is the default path to Perl in Unix?
Explanation: All Perl scripts generally begin with a #! (shebang) line. A script is a file containing a sequence of commands. The Perl scripts are text files, which can be ceated using any text editor.
7. Which of these is not optional?
SELECT select_list FROM table_list WHERE row_constraint GROUP BY grouping_columns;
Explanation: Given above was a basic syntax of the SELECT statement. Everything in the syntax is optional except the ‘select_list’ option. All the others are free to be omitted, and will work fine.
8. The basic operation of PHP is to interpret a script.
Explanation: The elementary operation of PHP is interpreting a script in order to produce a web page. This is sent to a client. A PHP script generally contains a mix of HTML and executable code.
9. The PHP interpreter switches mode continuously.
Explanation: As soon as the PHP interpreter comes across a special opening tag it switches from ‘text copy’ mode to ‘PHP code’ mode. It starts interpreting the file as PHP code to be executed.
10. How is the output from PHP generated?
a) statically generated
b) dynamically generated
c) not generated
d) no output
Explanation: The interpreter switches between code mode back and text mode when it sees another special tag which signals the end of the code. This enables the mix of static text with dynamically generated results.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL, here is complete set of 1000+ Multiple Choice Questions and Answers.