250+ TOP MCQs on Putting PHP to Work and Answers

MySQL Database Multiple Choice Questions 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

Answer: b
Clarification: 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

Answer: b
Clarification: 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) @

Answer: c
Clarification: 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

Answer: a
Clarification: 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

Answer: b
Clarification: 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.

  250+ TOP MCQs on MySQL Setup and Answers

6. A stored program associated with a schedule is ______________
a) Trigger
b) Event
c) Stored function
d) Stored procedure

Answer: b
Clarification: 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

Answer: a
Clarification: 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

Answer: c
Clarification: 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

Answer: b
Clarification: 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

Answer: d
Clarification: 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.

  250+ TOP MCQs on Data Value Categories and Answers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top