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?
a) $a[1]
b) $a[0]
c) $a.1
d) $a.0
View Answer
Explanation: If $a represents an array with numeric indices, its elements are accessed as $x[0], $x[1], 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.
a) True
b) False
View Answer
Explanation: The PHP arrays can even have both numeric and associative elements. For example, $x[1] 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?
a) .
b) *
c) ->
d) @
View Answer
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.
a) True
b) False
View Answer
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 ______________
a) cgi-inc
b) cgi-bin
c) cgi-usr
d) cgi-perl
View Answer
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 ______________
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 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
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.
8. What is the creation of a stored program similar to?
a) Trigger
b) Event
c) View
d) Table
View Answer
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 __________
a) bad
b) good
c) illegal
d) fare
View Answer
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?
a) 0
b) 1
c) 2
d) more than 1
View Answer
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.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Apply for Programming Internship
- Check MySQL Books
- Practice Programming MCQs
- Check Information Technology Books