MySQL Questions and Answers – Maintaining Logs

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Maintaining Logs”.

1. The log that contains a record of server startups and shutdowns and the messages about exceptional conditions is ______________
a) error log
b) general query
c) slow query log
d) binary log
View Answer

Answer: a
Explanation: The error log contains a record of server startups and shutdowns and the messages about problems or exceptional conditions. If the server fails to start this log provides the help.

2. The log that identifies statements that may be in need of being rewritten for better performance is ______________
a) error log
b) general query
c) slow query log
d) binary log
View Answer

Answer: c
Explanation: The purpose of the slow-query log is to help the identification of statements that may be in need of being rewritten for better performance. This helps in query optimizations.

3. The default value in seconds in the system variable ‘long_query_time’ is ______________
a) 5
b) 10
c) 20
d) 60
View Answer

Answer: b
Explanation: The server maintains a ‘long_query_time’ system variable that defines slow queries (10 seconds by default). If a query takes more than these seconds of real time it is considered slow.
advertisement
advertisement

4. The logging option to enable binary log index file is ______________
a) –log-bin-index
b) –bin-log-index
c) –index-log-bin
d) –index-bin-log
View Answer

Answer: a
Explanation: The ‘–log-bin-index’ is the logging option that enables the binary log index file. ‘–log-error’ enables the error log file. Similarly, –log enables the general log file.

5. Usage of aggregates in WHERE clause is not allowed.
a) True
b) False
View Answer

Answer: a
Explanation: The usage of aggregates inside ‘WHERE’ clauses is not allowed. For example, the following statement will not work: ‘SELECT * FROM my_table WHERE attribute_name = MAX(attribute_name)’, because the MAX value is not known yet.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. The operators that are used when a subquery returns multiple rows to be evaluated in comparison to the outer query are _____________
a) IN and NOT IN
b) EXISTS and NOT EXISTS
c) OUTER JOIN and INNER JOIN
d) LEFT JOIN and RIGHT JOIN
View Answer

Answer: a
Explanation: When there is a need to evaluate multiple rows in comparison to the outer query, the ‘IN’ and ‘NOT IN’ operators are used. They are used for testing whether a comparison value is present in a set of values.

7. The ALL subquery performs operations on _____________
a) row
b) column
c) table
d) database
View Answer

Answer: b
Explanation: The operators ‘ALL’ and ‘ANY’ are used to perform operations on columns. They are used in conjunction with a comparison operator in order to test the result of a column subquery.
advertisement

8. What is the kind of delete when deletion of an employee from the table also deletes that employee from another table?
a) transparent
b) concrete
c) elaborate
d) cascaded
View Answer

Answer: d
Explanation: In MySQL, a cascaded delete and update are possible where records can be deleted from multiple tables. These tables are related with the help of foreign keys. Foreign keys make table updates flexible.

9. The storage engine in MySQL that provides foreign key support is ___________
a) TRANSACTION
b) InnoDB
c) MyISAM
d) MEMORY
View Answer

Answer: b
Explanation: In MySQL, there are a list of storage engines to choose from. Each storage engine provides its own set of facilities. The foreign key facilities are provided by the InnoDB storage engine.
advertisement

10. What is the property of InnoDB that enforces foreign key relationships stay intact?
a) atomicity
b) durability
c) consistency
d) referential integrity
View Answer

Answer: d
Explanation: The storage engine responsible for providing foreign key support is InnoDB. It enforces that the rules guarantee the foreign key relationship stays intact with no mismatching of data.

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.

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.