MySQL Questions and Answers – PHP Overview

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

1. The basic operation of PHP is to interpret a script.
a) True
b) False
View Answer

Answer: a
Explanation: The elementary operation of PHP is interpreting a script in order to produce a web page. This is sent to a client. A PHP script generally contains a mix of HTML and executable code.

2. The PHP interpreter switches mode continuously.
a) True
b) False
View Answer

Answer: a
Explanation: As soon as the PHP interpreter comes across a special opening tag it switches from ‘text copy’ mode to ‘PHP code’ mode. It starts interpreting the file as PHP code to be executed.

3. The output from PHP is __________
a) statically generated
b) dynamically generated
c) not generated
d) no output
View Answer

Answer: b
Explanation: The interpreter switches between code mode back and text mode when it sees another special tag which signals the end of the code. This enables the mix of static text with dynamically generated results.
advertisement
advertisement

4. PHP variables are preceded by __________
a) _
b) @
c) $
d) &
View Answer

Answer: c
Explanation: All the PHP scripts that use variables have variable names preceded by the dollar sign (‘$’). The variables are signified by this identifier, irrespective of the value it stores.

5. The datatype best suited to store currency values is __________
a) INT
b) FLOAT
c) DOUBLE
d) DECIMAL
View Answer

Answer: d
Explanation: Currency is a numeric information. For monetary calculations, FLOAT and DOUBLE are subject to rounding error and may not be suitable. A DECIMAL(M, 2) type is best suited for it.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What returns 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.

7. What 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.
advertisement

8. Which statement is used to produce a stored function?
a) PRODUCE FUNCTION
b) CREATE FUNCTION
c) PRODUCE PROCEDURE
d) CREATE PROCEDURE
View Answer

Answer: b
Explanation: The ‘CREATE FUNCTION’ statement is used to create a stored function in MySQL. The ‘CREATE PROCEDURE’ statement is used to create a stored procedure instead, from which values are not returned.

9. The number of values that can be returned from a given stored function is ______________
a) 0
b) 1
c) 2
d) 3
View Answer

Answer: b
Explanation: In MySQL, the stored function cannot return multiple values. Instead, multiple stored functions can be written and invoked from within a single statement however, they are different from stored procedures.
advertisement

10. The statement used to create a trigger is ______________
a) CREATE TRIGGER
b) CREATE TRIGGERS
c) PRODUCE TRIGGER
d) PRODUCE TRIGGERS
View Answer

Answer: a
Explanation: In order to create a trigger, the CREATE TRIGGER statement is used. The definition indicates the particular type of statement for which the trigger activates and whether it activates before or after the rows are modified.

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.