This Quiz contains totally 25 Questions each carry 1 point for you.
1. Which PHP function is used to open a connection to a MySQL server?
mysql_connect()
mysql_open()
mysqli_connect()
mysqli_open()
Correct!
Wrong!
2. Which PHP function is used to close a MySQL connection?
mysql_close()
mysqli_end()
mysqli_close()
mysql_end()
Correct!
Wrong!
3. What is the purpose of mysqli_select_db() function in PHP?
To create a new database
To delete an existing database
To select an existing database
To check if a database exists
Correct!
Wrong!
4. How can we execute an SQL query in PHP?
mysql_query()
mysqli_execute()
mysql_execute()
mysqli_query()
Correct!
Wrong!
5. What does mysqli_fetch_array() function do in PHP?
Fetches a result row as an associative array, a numeric array, or both.
Fetches a result row as a JSON object.
Fetches a result row as an XML object.
Fetches a result row as a string.
Correct!
Wrong!
6. Which PHP function is used to return the number of rows in a result set?
mysqli_count_rows()
mysqli_total_rows()
mysqli_num_rows()
mysqli_rows()
Correct!
Wrong!
7. What is mysqli_real_escape_string() function used for?
To escape special characters in a string for use in an SQL statement.
To unescape special characters in a string for use in an SQL statement.
To count the number of special characters in a string.
None of the above.
Correct!
Wrong!
8. What does mysqli_free_result() do in PHP?
Deletes the result.
Frees the memory associated with the result.
Converts the result to a string.
None of the above.
Correct!
Wrong!
9. What does mysqli_affected_rows() function do?
Counts the number of rows in a result set.
Returns the number of rows affected by the last SELECT, INSERT, UPDATE, REPLACE, or DELETE query.
Returns the number of rows affected by the last SELECT query only.
None of the above.
Correct!
Wrong!
10. Which function is used to send a raw SQL query to MySQL?
mysqli_raw_query()
mysqli_query()
mysqli_send_query()
None of the above
Correct!
Wrong!
11. What is the use of mysqli_connect_error() function?
Returns the error description from the last connection error.
Returns the error code from the last connection error.
Returns the error code from the last query error.
None of the above.
Correct!
Wrong!
12. Which of the following is not a valid MySQLi Fetch mode?
MYSQLI_ASSOC
MYSQLI_BOTH
MYSQLI_NUM
MYSQLI_VAL
Correct!
Wrong!
13. How do you specify the port number when connecting to a MySQL server in PHP?
As a third parameter to the mysqli_connect() function.
As a separate function call after connecting.
As a part of the host string in mysqli_connect(). .
Port number can't be specified in PHP
Correct!
Wrong!
14. Which PHP function is used to prevent SQL injections?
mysqli_real_escape_string()
mysqli_secure_query()
mysqli_injection_prevent()
mysqli_sql_secure()
Correct!
Wrong!
15. How do you fetch the last inserted ID in a MySQLi operation?
Using mysqli_insert_id()
Using mysqli_last_id()
Using mysqli_get_id()
Using mysqli_fetch_id()
Correct!
Wrong!
16. What function would you use to fetch all result rows as an associative array in PHP?
mysqli_fetch_all()
mysqli_fetch_array_all()
mysqli_fetch_assoc_all()
mysqli_fetch_total()
Correct!
Wrong!
17. What is the return type of mysqli_query() function on successful running of SELECT statement ?
An associative array of the result set.
A string that contains the query.
A result object representing the result set.
None of the above.
Correct!
Wrong!
18. What does the 'i' in mysqli stand for in PHP?
Improved
Integrated
Interface
Independent
Correct!
Wrong!
19. Which of the following is NOT a valid MySQLi result mode for the function mysqli_fetch_all()?
MYSQLI_NUM
MYSQLI_ASSOC
MYSQLI_BOTH
MYSQLI_SINGLE
Correct!
Wrong!
20. What does the PHP function mysqli_errno() do?
It returns the last error code number from the last call to a MySQLi function.
It returns the last error message from the last call to a MySQLi function.
It returns the total number of errors occurred during the execution of a PHP script.
None of the above.
Correct!
Wrong!
21. Which PHP function is used to return a row from a recordset as an associative array and/or numeric array?
mysqli_fetch()
mysqli_return_row()
mysqli_fetch_row()
mysqli_fetch_array()
Correct!
Wrong!
22. How can we get the number of fields in a result set using PHP?
mysqli_num_fields()
mysqli_field_count()
mysqli_get_fields()
mysqli_fields_num()
Correct!
Wrong!
23. Which PHP function is used to set the character set for the database connection?
mysqli_set_charset()
mysqli_charset_set()
mysqli_change_charset()
mysqli_charset_change()
Correct!
Wrong!
24. What does the PHP function mysqli_error_list() return?
An array of errors for the most recent MySQLi function calls.
An array of all error messages from the last MySQLi function call.
An array of all MySQLi function calls that have caused an error. .
None of the above
Correct!
Wrong!
25. What does mysqli_fetch_assoc() function do in PHP?
Fetches a result row as a numeric array.
Fetches a result row as an associative array.
Fetches a result row as a string.
Fetches a result row as a JSON object.
Correct!
Wrong!
Share the quiz to show your results !
Subscribe to see your results
Ignore & go to results
MySQL with PHP – Quiz
You got %%score%% of %%total%% right
%%description%%
%%description%%
Loading...