PHP and MySql Database Connectivity Objective Test
Qno.1: MCQs
- 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 - SQL is not case sensitive. SELECT is the same as select.\
A) True
B) False - 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 - 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() - 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() - 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() - What is the default port number for MySql?
- 8080
- 80
- 3306
- 3300
- What does mysql_fetch_row return?
- A single column of the database
- Number of tables
- Single row as an array
- Single row as a string
- Which php function is used for running the insert query?
- mysql_insert
- mysql_insert_row
- mysql_fetch_row
- mysql_query
- ODBC stands for ______________
- Open database connectivity
- Oracle database connectivity
- Operational database connectivity
- Organized database connection
Qno.2:True/false
- Database hostname is the computer on which the database is installed.
- The dbms never allows primary key to be null.
- MySql is open source DBMS.
- Mysql_close is used for closing the database connection
- The password for the database can be set as null.
- die() is used for terminating the page.
- @ is the error control operator
- sqli_connect and sql_connect can be used interchangeably.
- mysql_free_result closes the result set.
- mysql_fetch_assoc returns an associative array.