MySQL Questions and Answers – Structure of the Data Directory

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Structure of the Data Directory”.

1. Each database has a data directory located under database directory.
a) True
b) False
View Answer

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

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

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

4. The data directory subdirectory that corresponds to the nbdinfo database is ______________
a) mysql
b) performance_schema
c) sys
d) nbdinfo
View Answer

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

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

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

6. mysql_next_result() does not return.
a) True
b) False
View Answer

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

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

8. What is the synonym for CHARACTER SET?
a) CSET
b) CHSET
c) CHARSET
d) CHCSET
View Answer

Answer: c
Explanation: ‘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
View Answer

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

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.