Test Your Knowledge in PHP and MySql

PHP and MySql Database Connectivity Objective Test

Qno.1: MCQs

  1. 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
  2. SQL is not case sensitive. SELECT is the same as select.\
    A) True
    B) False
  3. 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
  4. 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()
  5. 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()
  6. 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()
  7. What is the default port number for MySql?
    1. 8080
    2. 80
    3. 3306
    4. 3300
  8. What does mysql_fetch_row return?
    1. A single column of the database
    2. Number of tables
    3. Single row as an array
    4. Single row as a string
  9. Which php function is used for running the insert query?
    1. mysql_insert
    2. mysql_insert_row
    3. mysql_fetch_row
    4. mysql_query
  10. ODBC stands for ______________
    1. Open database connectivity
    2. Oracle database connectivity
    3. Operational database connectivity
    4. Organized database connection

Qno.2:True/false

  1. Database hostname is the computer on which the database is installed.
  2. The dbms never allows primary key to be null.
  3. MySql is open source DBMS.
  4. Mysql_close is used for closing the database connection
  5. The password for the database can be set as null.
  6. die() is used for terminating the page.
  7. @ is the error control operator
  8. sqli_connect and sql_connect can be used interchangeably.
  9. mysql_free_result closes the result set.
  10. mysql_fetch_assoc returns an associative array.