Question 1:
Which one of the following databases has PHP supported almost since the beginning?
A.
Oracle Database
B.
SQL
C.
SQL+
D.
MySQL
Answer: _________
Question 2:
The updated MySQL extension released with PHP 5 is typically referred to as.
A.
MySQL
B.
mysql
C.
mysqli
D.
mysqly
Answer: _________
Question 3:
Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?
A.
extension=php_mysqli.dll
B.
extension=mysql.dll
C.
extension=php_mysqli.dl
D.
extension=mysqli.dl
Answer: _________
Question 4:
In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?
A.
PHP 5.0
B.
PHP 5.1
C.
PHP 5.2
D.
PHP 5.3
Answer: _________
Question 5:
Which one of the following statements instantiates the mysqli class?
A.
mysqli = new mysqli()
B.
$mysqli = new mysqli()
C.
$mysqli->new.mysqli()
D.
mysqli->new.mysqli()
Answer: _________
Question 6:
Which one of the following methods can be used to diagnose and display information about a MySQL connection error?
A.
connect_errno()
B.
connect_error()
C.
mysqli_connect_errno()
D.
mysqli_connect_error()
Answer: _________
Question 7:
Which method returns the error code generated from the execution of the last MySQL function?
A.
errno()
B.
errnumber()
C.
errorno()
D.
errornumber()
Answer: _________
Question 8:
If there is no error, then what will the error() method return?
A.
TRUE
B.
FALSE
C.
Empty String
D.
0
Answer: _________
Question 9:
In PHP in order to access MySQL database you will use:
A.
mysqlconnect() function
B.
mysql-connect() function
C.
mysql_connect() function
D.
sql_connect() function
Answer: _________
Question 10:
Transactions are used to treat sets of SQL statements atomically.
A.
True
B.
False
Answer: _________
Question 11:
SQL is not case sensitive. SELECT is the same as select.
A.
True
B.
False
Answer: _________
Question 12:
Which of the following is not an SQL aggregate function?
A.
AVG
B.
SUM
C.
MIN
D.
MAX
Answer: _________
Question 13:
What does the DESC keyword do in the following query? SELECT *
FROM MY_TABLE
WHERE ID > 0
ORDER BY ID, NAME DESC"
A.
It causes the dataset returned by the query to be sorted in descending order
B.
It causes rows with the same ID to be sorted by NAME in ascending order
C.
It causes rows with the same ID to be sorted by NAME in descending order
D.
It causes rows to be sorted by NAME first and then by ID
Answer: _________
Question 14:
The ............. statement is used to delete a table.
A.
DROP TABLE
B.
DELETE TABLE
C.
DEL TABLE
D.
REMOVE TABLE
Answer: _________
Question 15:
What will happen at the end of the following sequence of SQL commands? BEGIN TRANSACTION
DELETE FROM MYTABLE WHERE ID=1
DELETE FROM OTHERTABLE
ROLLBACK TRANSACTION
A.
The contents of OTHERTABLE will be deleted
B.
The contents of both OTHERTABLE and MYTABLE will be deleted
C.
The contents of OTHERTABLE will be deleted, as will be all the contents of MYTABLE whose ID is 1
D.
The database will remain unchanged to all users except the one that executes these queries.
Answer: _________
Question 16:
Use the .............. to delete the data inside the table, and not the table itself?
A.
DROP TABLE
B.
DELETE TABLE
C.
TRUNCATE TABLE
D.
REMOVE TABLE
Answer: _________
Question 17:
Can joins be nested?
A.
True
B.
False
Answer: _________
Question 18:
Which one of the following methods is responsible for sending the query to the database?
A.
query()
B.
send_query()
C.
sendquery()
D.
query_send()
Answer: _________
Question 19:
Which one of the following methods recuperates any memory consumed by a result set?
A.
destroy()
B.
remover()
C.
alloc()
D.
free()
Answer: _________
Question 20:
Which of the methods are used to manage result sets using both associative and indexed arrays?
A.
get_array() and get_row()
B.
get_array() and get_column()
C.
fetch_array() and fetch_row()
D.
fetch_array() and fetch_column()
Answer: _________
Question 21:
Which one of the following method is used to retrieve the number of rows affected by an INSERT, UPDATE, or DELETE query?
A.
num_rows()
B.
affected_rows()
C.
changed_rows()
D.
new_rows()
Answer: _________
Question 22:
Which version of MySQL introduced the prepared statements?
A.
MySQL 4.0
B.
MySQL 4.1
C.
MySQL 4.2
D.
MySQL 4.3
Answer: _________
Question 23:
Which of the following methods is used to execute the statement after the parameters have been bound?
A.
bind_param()
B.
bind_result()
C.
bound_param()
D.
bound_result()
Answer: _________
Question 24:
Which one of the following methods is used to recuperating prepared statements resources?
A.
end()
B.
finish()
C.
final()
D.
close()
Answer: _________
Question 25:
Which method retrieves each row from the prepared statement result and assigns the fields to the bound results?
A.
get_row()
B.
fetch_row()
C.
fetch()
D.
row()
Answer: _________
Question 26:
Which method rolls back the present transaction?
A.
commit()
B.
undo()
C.
back()
D.
rollback()
Answer: _________
Question 27:
When you are building administrative links you’ll need to accept two arguments, which of the following are they?
A.
URL of previous entry and URL of the entry you are working with
B.
The current page and previous page
C.
URL of previous entry and previous page
D.
The current page and URL of the entry you are working with
Answer: _________
Question 28:
Once your application can generate administrative links, you need to load those links into _________
A.
php.ini
B.
index.ini
C.
index.php
D.
start.php
Answer: _________
Question 29:
The URLs in the administrative links won’t mean anything to admin.php unless you modify _________
A.
.htaccess
B.
.adminaccess
C.
.htmlaccess
D.
.urlaccess
Answer: _________
Question 30:
The (|/) tells the server to match ___________
A.
nothing
B.
forward slash
C.
backward slash
D.
either nothing or a forward slash
Answer: _________
Question 31:
([w-]+) will match ___________
A.
one word characters
B.
one or more word characters
C.
one or more word characters and/or hypens
D.
one or more word characters and hypens
Answer: _________
Question 32:
You need to check whether ______ is set, to determine whether you’re editing an entry or creating a new one.
A.
$_GET[‘url’].
B.
$_SET[‘url’].
C.
$_GET[‘admin’].
D.
$_SET[‘admin’].
Answer: _________
Question 33:
To identify entries marked for deletion, you check whether $_GET[‘page’] == ‘delete’ inside __________
A.
index.php
B.
index.ini
C.
admin.php
D.
.htaccess
Answer: _________
Question 34:
Your confirmation form submits your choice, via the _______ method, to ________
A.
GET index.php
B.
GET admin.php
C.
POST index.php
D.
POST admin.php
Answer: _________
Question 35:
When a user confirms that he wishes to delete an entry, that entry’s URL is passed to a function which removes the entry from the __________
A.
index.php
B.
function.inc.php
C.
database
D.
admin.php
Answer: _________
Question 36:
Which of the following DBMSs do not have a native PHP extension?
A.
MySQL
B.
IBM DB/2
C.
PostgreSQL
D.
Microsoft SQL Server
Answer: _________
Question 37:
Which one of the following statements should be used to include a file?
A.
#include ‘filename’
B.
include ‘filename’
C.
@include ‘filename’
D.
#include
Answer: _________
Question 38:
Which one of the following statements is used to create a table?
A.
CREATE TABLE table_name (column_name column_type)
B.
CREATE table_name (column_type column_name)
C.
CREATE table_name (column_name column_type)
D.
CREATE TABLE table_name (column_type column_name)
Answer: _________
Question 39:
Which one of the following statements can be used to select the database?
A.
$mysqli=select_db(‘databasename’)
B.
mysqli=select_db(‘databasename’)
C.
mysqli->select_db(‘databasename’)
D.
$mysqli->select_db(‘databasename’)
Answer: _________
Answer Key
1:
D
2:
C
Solution: The updated MySQL extension with PHP 5 is known as MySQL and typically referred to as mysqli.
3:
A
Solution: Also make sure that extension_dir directive points to the appropriate directory.
4:
D
Solution: PHP required that MySQL client library be installed on the server from which PHP was communicating with MySQL, whether the MySQL server also happened to reside locally or elsewhere. PHP 5.3 removes this problem by introducing MySQL Native Driver.
5:
B
Solution: If you choose to interact with MySQL server using the object-oriented interface, you need to first instantiate the mysqli class via its constructor.
6:
C
Solution: The mysqli extension includes a few features that can be used to capture error messages or alternatively you can use exceptions.
7:
A
Solution: Error numbers are often used in lieu of natural-language message to ease software internationalization efforts and allow for customization of error messages.
8:
C
9:
C
10:
A
11:
A
12:
N/A
13:
C
14:
A
15:
N/A
16:
C
17:
A
18:
A
Solution: Its prototype looks like-
class mysqli
{
mixed query(string query [, int resultmode])
}
19:
D
Solution: Once this method is executed, the result set is no longer available.
20:
C
Solution: Their prototype is as follows-
calss mysqli_result
{
mixed fetch_array ([int resulttype])
}
calss mysqli_result
{
mixed fetch_row()
}
21:
B
Solution: The method num_rows() is only useful for determining the number of rows retrieved by a SELECT query. But to retrieve the number of rows affected by INSERT, UPDATE, or DELETE query, use affected_rows().
22:
B
Solution: When the query() method is looped repeatedly it comes at a cost of both overhead, because of the need to repeatedly parsing of the almost identical query for validity, and coding convenience, because of the need to repeatedly reconfigure the query using the new values for each iteration. To help resolve the issues incurred by repeatedly executed queries, MySQL introduced prepared statements.
23:
A
Solution: Once the statement has been prepared, it needs to be executed. Exactly when it’s executed depends upon whether you want to work with bound parameters or bound results. In the case of bound parameters, you’d execute the statement after the parameters have been bound with the bind_param() method.
24:
D
Solution: Once you’ve finished using a prepared statement, the resources it requires can be recuperated with the close() method.
25:
C
Solution: Its prototype follows:
class mysqli
{
boolean fetch()
}
26:
D
Solution: Its prototype follows:
class mysqli
{
boolean rollback()
}
27:
D
Solution: Your function should look like this:
function adminLinks($page, $url)
{
//Build admin links here
}
28:
C
Solution: You place your administrative links only on the full display of an entry, so you must place the call to load information from adminLinks() within a conditional statement
29:
A
Solution: You need to modify .htaccess with an additional rule that handles URLs passed in a link to admin.php.
30:
D
Solution: The vertical pipe character (|) is the regular expression equivalent of “or”.
31:
C
Solution: ([w-]+), will match one or more word characters and/or hyphens—which is what your custom entry URLs consist.
32:
A
Solution: If an entry is being edited, you need to load the existing entry data and save each piece in a variable.
33:
C
Solution: In admin.php, you check whether $_GET[‘page’] == ‘delete’, then pass the entry URL to be deleted to a function.
34:
D
Solution: To process this, you need to add an additional block of code to the top of admin.php that determines what choices you’ve made and act accordingly.
35:
C
Solution: If the function is successful, you send the user to the main page. If it fails, you stop execution of the script and display an error, letting the user know that something went wrong.
36:
N/A
37:
B
Solution: An example of this-
38:
A
39:
D