MySQL Questions and Answers – Compound Statements and Statement Delimiters

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Compound Statements and Statement Delimiters”.

1. Which of these return a result to the client?
a) Stored functions
b) Stored procedures
c) Triggers
d) Events
View Answer

Answer: a
Explanation: Stored functions return a result from a calculation and can be used in expressions. Stored procedures do not return a result directly but can be used to perform general computations.

2. Which of these is defined to execute when the table is modified only?
a) Stored functions
b) Stored procedures
c) Triggers
d) Events
View Answer

Answer: c
Explanation: In MySQL, triggers are associated with a table. They are defined to execute when the table is modified via INSERT, DELETE or UPDATE statements. MySQL supports objects to be stored on server side.

3. What executes on a time activated basis according to a schedule?
a) Stored program
b) Events
c) Triggers
d) Stored procedures
View Answer

Answer: b
Explanation: In MySQL, the events execute on a time activated basis according to a schedule. Triggers are defined to execute when the table is modified via INSERT, DELETE or UPDATE statements.
advertisement
advertisement

4. Stored programs improve database security.
a) True
b) False
View Answer

Answer: a
Explanation: Stored programs improve database security because controlled access can be enabled to sensitive data by appropriate selection of the privileges a program has when it executes.

5. Which character does the mysql client program recognize as a statement delimiter?
a) :
b) .
c) ;
d) ,
View Answer

Answer: c
Explanation: By default, mysql itself recognizes the semicolon as a statement delimiter, so the delimiter must be redefined temporarily to cause mysql to pass the entire stored program definition to the server.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. Which command is used to redefined the mysql delimiter?
a) redefine_delim
b) delim_redefine
c) delimiter
d) redefine
View Answer

Answer: c
Explanation: To redefine the mysql delimiter, the delimiter command is used. A delimiter is a sequence of characters. It specifies the boundary between the separate regions in data streams.

7. Which of the following characters cannot be used as a delimiter?
a) ,
b) .
c) ;
d) \
View Answer

Answer: d
Explanation: In MySQL, the character backslash character is reserved for specifying escape sequences. For example, the escape sequence ‘\t’ specifies a tab space character. It cannot be used as a delimiter.
advertisement

8. Stored routines refers to stored functions and procedures.
a) True
b) False
View Answer

Answer: a
Explanation: In MySQL, the stored routines is a limited term. It refers only to the stored functions and procedures. Both types of objects are defined using the similar syntax and are discussed together.

9. Stored programs refer to stored objects of how many of the following types?

functions, procedures, triggers, events
advertisement

a) 0
b) 1
c) 3
d) 4
View Answer

Answer: d
Explanation: In MySQL, the “stored programs” refers collectively to the stored objects of all types, namely, the functions, procedures, triggers, and events. They improve database security.

10. Which of the following statements does not modify the table?
a) INSERT
b) UPDATE
c) DELETE
d) SELECT
View Answer

Answer: d
Explanation: In MySQL, the ‘SELECT’ statement is used to display the tables or their components according to some specified conditions and clauses. It does not modify the table unlike the others.

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.