MySQL Database Multiple Choice Questions on “Structure of the Data Directory”.
1. Each database has a data directory located under database directory.
a) True
b) False
Answer: b
Clarification: In MySQL, each database has a database directory that is located under the data directory. The tables, views and triggers within a database correspond to files in the database directory.
2. In the database directory of the database each view and trigger object is associated with how many files?
a) 0
b) 1
c) 2
d) 3
Answer: b
Clarification: Each view and trigger object is associated with one file in the database directory of the database containing that object. A view consists of a .frm file that contains the view definition.
3. What is the maximum number of characters allowed for a database name to have?
a) 16
b) 32
c) 64
d) 128
Answer: c
Clarification: MySQL allows the database names and the table names to be a maximum of 64 characters long. The length of these names is also bound by the length allowed by the operating system on the machine.
4. The data directory subdirectory that corresponds to the nbdinfo database is ______________
a) mysql
b) performance_schema
c) sys
d) nbdinfo
Answer: b
Clarification: The sys directory corresponds to the sys schema. It provides a set of objects to interpret Performance Schema information. The ‘performance_schema’ directory corresponds to the Performance Schema.
5. Which of these is preferred when stored procedures are not being used?
CLIENT_MULTI_STATEMENTS, mysql_set_server_option()
a) CLIENT_MULTI_STATEMENTS
b) mysql_set_server_option()
c) any of the two
d) neither of the two
Answer: c
Clarification: If the program does not use stored procedures anyone is suitable. If the program uses stored procedures and invokes a ‘CALL’ statement that returns a result set, the first method is better.
6. mysql_next_result() does not return.
a) True
b) False
Answer: b
Clarification: The function ‘mysql_next_result()’ returns a status and initiates retrieval of the next set if more results are available. The status is zero if more results are available and -1 if not.
7. The option that executes all SQL statements in a SQL script irrespective of the number of errors is ______________
a) –ensure
b) –force
c) –violent
d) –run
Answer: b
Clarification: If SQL queries in a file are run using mysql in batch mode, mysql either quits after the first error. If the –force option is specified all the queries are executed indiscriminately.
8. What is the synonym for CHARACTER SET?
a) CSET
b) CHSET
c) CHARSET
d) CHCSET
Answer: c
Clarification: ‘CHARACTER SET’ can be abbreviated into ‘CHARSET’ and can be used in the same contexts and statements where ‘CHARACTER SET’ is used. ‘charset’ is the server-supported character set.
9. What is the statement used to select a default database?
a) USE
b) CREATE
c) DROP
d) SCHEMA
Answer: a
Clarification: MySQL has the facility to use various statements specifically at the database level. For selecting a default database, the keyword or clause used is the ‘USE’ statement.