Php Databases Handling(Engineering > Computer Science And Engineering > Php ) Questions and Answers

Question 1. The updated MySQL extension released with PHP 5 is typically referred to as.
  1.    MySQL
  2.    mysqly
  3.    mysql
  4.    mysqli
Explanation:-
Answer: Option D. -> mysqli

Question 2. In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?
  1.    PHP 5.1
  2.    PHP 5.2
  3.    PHP 5.3
  4.    PHP 5.0
Explanation:-
Answer: Option C. -> PHP 5.3

Question 3. Which one of the following statements is used to create a table?
  1.    CREATE table_name (column_type column_name);
  2.    CREATE TABLE table_name (column_name column_type);
  3.    CREATE table_name (column_name column_type);
  4.    CREATE TABLE table_name (column_type column_name);
Explanation:-
Answer: Option B. -> CREATE TABLE table_name (column_name column_type);

Question 4. Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?
  1.    extension=mysql.dll
  2.    extension=php_mysqli.dl
  3.    extension=mysqli.dl
  4.    extension=php_mysqli.dll
Explanation:-
Answer: Option D. -> extension=php_mysqli.dll

Question 5. Which one of the following databases has PHP supported almost since the beginning?
  1.    MySQL
  2.    SQL+
  3.    SQL
  4.    Oracle Database
Explanation:-
Answer: Option A. -> MySQL

Question 6. Which one of the following statements instantiates the mysqli class?
  1.    mysqli = new mysqli()
  2.    $mysqli->new.mysqli()
  3.    mysqli->new.mysqli()
  4.    $mysqli = new mysqli()
Explanation:-
Answer: Option D. -> $mysqli = new mysqli()

Question 7. If there is no error, then what will the error() method return?
  1.    0
  2.    FALSE
  3.    TRUE
  4.    Empty String
Explanation:-
Answer: Option D. -> Empty String

Question 8. Which one of the following methods can be used to diagnose and display information about a MySQL connection error?
  1.    mysqli_connect_error()
  2.    mysqli_connect_errno()
  3.    connect_errno()
  4.    connect_error()
Explanation:-
Answer: Option B. -> mysqli_connect_errno()

Question 9. Which one of the following statements can be used to select the database?
  1.    $mysqli=select_db(‘databasename’);
  2.    mysqli=select_db(‘databasename’);
  3.    $mysqli->select_db(‘databasename’);
  4.    mysqli->select_db(‘databasename’);
Explanation:-
Answer: Option C. -> $mysqli->select_db(‘databasename’);

Question 10. Which method returns the error code generated from the execution of the last MySQL function?
  1.    errorno()
  2.    errnumber()
  3.    errno()
  4.    errornumber()
Explanation:-
Answer: Option C. -> errno()