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
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
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
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.
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
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
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.
6. If the scheduler is stopped, no events run.
a) True
b) False
View Answer
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
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.
8. Which clause specifies periodic execution at fixed intervals?
a) EVERY
b) ALL
c) AT
d) ALTERNATE
View Answer
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
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.
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
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.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Apply for Programming Internship
- Check Information Technology Books
- Check MySQL Books
- Practice Programming MCQs