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
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
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
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.
4. PHP variables are preceded by __________
a) _
b) @
c) $
d) &
View Answer
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
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.
6. What returns a result to the client?
a) Stored functions
b) Stored procedures
c) Triggers
d) Events
View Answer
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
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.
8. Which statement is used to produce a stored function?
a) PRODUCE FUNCTION
b) CREATE FUNCTION
c) PRODUCE PROCEDURE
d) CREATE PROCEDURE
View Answer
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
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.
10. The statement used to create a trigger is ______________
a) CREATE TRIGGER
b) CREATE TRIGGERS
c) PRODUCE TRIGGER
d) PRODUCE TRIGGERS
View Answer
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.
- Check MySQL Books
- Apply for Programming Internship
- Check Information Technology Books
- Practice Programming MCQs