This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on ” Putting PHP to Work”.
1. In PHP, if $a represents an array with numeric indices, how is the first element accessed?
Explanation: If $a represents an array with numeric indices, its elements are accessed as $x, $x, and so on. In general terms, each element at the position i is accessed and used as $a[i – 1].
2. Arrays cannot have associative indices in PHP.
Explanation: The PHP arrays can even have both numeric and associative elements. For example, $x and $x[“large”] can both be the elements of the same array. $x can be an object, whose elements are accessed by the arrow ‘->’ operated.
3. In PHP, which operator is used to access property of an object?
Explanation: If $a represents an object, the properties it has can be accessed as $a->property-name. For instance, $a->white, $a->black, $a->blue, $a->red can be the properties of $a and accessed in this way.
4. PHP scripts are located in the web server document tree.
Explanation: The PHP scripts are different from DBI scripts since PHP scripts are located within the web server document tree while DBI scripts are located in a cgi-bin directory located outside of document tree.
5. DBI scripts are located in the directory ______________
Explanation: DBI scripts are located in a cgi-bin directory located outside of document tree. The PHP scripts are different from DBI scripts since PHP scripts are located within the web server document tree.
6. A stored program associated with a schedule is ______________
c) Stored function
d) Stored procedure
Explanation: The MySQL version 5.1.6 and above has an event scheduler. It enables to perform time activated database operations. An event is a stored program that is associated with a schedule.
7. The line used to turn on the event scheduler is ______________
a) event_scheduler = ON
b) eventscheduler = ON
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.
8. What is the creation of a stored program similar to?
Explanation: When a stored program is created, an object is created that is to be executed later. This also the case when a view is defined: It sets up a SELECT statement intended for later invocation.
9. When the security context enables carefully written stored programs to be set up that provide controlled access to tables for users, it is called __________
Explanation: The security context is good if it enables carefully written stored programs to be set up that provide controlled access to tables for users who are not able to access them directly.
10. What is the maximum number of indexes on MyISAM table?
d) more than 1
Explanation: In MySQL, for a MyISAM table, there can be more than one indexes. The data rows of the MyISAM table are stored in a data file and the index values are stored in a separate index file.
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.