MySQL Questions and Answers – Events

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

1. Which of these is a stored program associated with a schedule?
a) Trigger
b) Event
c) Stored function
d) Stored procedure
View Answer

Answer: b
Explanation: The MySQL version 5.1.6 and above has an event scheduler. It enables us to perform time activated database operations. An event is a stored program that is associated with a schedule.

2. The event scheduler does not run by default.
a) True
b) False
View Answer

Answer: a
Explanation: The event scheduler does not run by default, so it must be turned on if events are to be used. An event is a stored program that is associated with a schedule to perform database operations.

3. Which of the following lines is used to turn on the event scheduler?
a) event_scheduler = ON
b) eventscheduler = ON
c) event_scheduler_ON
d) events_scheduler_ON
View Answer

Answer: a
Explanation: The line ‘event_scheduler = ON’ is put in the option file that the server reads. The event scheduler does not run by default. It must be turned on if events are to used in the database.
advertisement
advertisement

4. Which statement is used to check the status of the event scheduler at runtime?
a) SHOW STATUS OF ‘event_scheduler’
b) SHOW VARIABLES OF ‘event_scheduler’
c) SHOW STATUS LIKE ‘event_scheduler’
d) SHOW VARIABLES LIKE ‘event_scheduler’
View Answer

Answer: d
Explanation: In MySQL, in order to check the status of the event scheduler at runtime, the statement: SHOW VARIABLES LIKE ‘event_scheduler’; is used. The event_scheduler is a system variable.

5. Which value of event_scheduler enables checking status but not changing it at runtime?
a) ON
b) OFF
c) DISABLED
d) ENABLED
View Answer

Answer: c
Explanation: In MySQL, if the event_scheduler is set to ‘DISABLED’ at startup, its status cannot be changed but can be checked at runtime. The events can be created but they will not execute.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. If the scheduler is stopped, no events run.
a) True
b) False
View Answer

Answer: a
Explanation: In MySQL, if the event scheduler is stopped, no events are run. It is also possible to leave the scheduler running but disable the individual events. This can be done with ‘DISABLED’.

7. Which log does the event scheduler log to?
a) error
b) record
c) library
d) update
View Answer

Answer: a
Explanation: In MySQL, the event scheduler writes to the error log of the server, which can be checked for information about what the scheduler is doing. It logs the events as it runs them.
advertisement

8. Which clause specifies periodic execution at fixed intervals?
a) EVERY
b) ALL
c) AT
d) ALTERNATE
View Answer

Answer: a
Explanation: The ‘EVERY n interval’ clause specifies the periodic execution at fixed intervals. The interval values are like those used for the DATE_ADD() function, such as HOUR, DAY or MONTH.

9. To create or drop events for a database, which privilege should be granted?
a) CREATE
b) DROP
c) PRIVILEGE
d) EVENT
View Answer

Answer: d
Explanation: In MySQL, all events belong to some database, so the EVENT privilege must be granted for that database in order to both create or drop the events for it. An event is a stored program.
advertisement

10. The default definer of an event is the user who _______________
a) created the database
b) created the event
c) created the table
d) created the column
View Answer

Answer: b
Explanation: Unless the event has been altered, the default definer of an event is the user who created the event. In this case, the definer is the one who called the last ‘ALTER EVENT’ 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.

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.