7 quizzes found.

Which of the following is not a valid PDO DSN?

  1. All of the above are valid
  2. mysql:unix_socket=/tmp/mysql.sock;dbname=testdb
  3. oci:dbname=//localhost:1521/mydb
  4. mysql:host=localhost;port=3307;dbname=testdb
  5. sqlite2:/opt/databases/mydb.sq2

Choose 1 answers

When connecting to a database using PDO, what must be done to ensure that database credentials are not compromised if the connection were to fail?

  1. wrap the PDO DSN in a try/catch block to catch any connection exception
  2. Use constants in the PDO DSN
  3. Place the login credentials in the php.ini file
  4. Disable E_STRICT and E_NOTICE error reporting levels

Choose 1 answers

Implementing your own PDO class requires which steps from the list below?

  1. Extending the PDOStatement Class
  2. Set the PDO::ATTR_STATEMENT_CLASS parameter
  3. Call the PDO::setStatementClass() method
  4. Extend the PDO class
  5. Set the PDO::ATTR_USE_CLASS paramater

Choose 3 answers

Which of the following methods are used to fetch data from a PDO Statement?

  1. fetchColumn()
  2. fetchObject()
  3. fetch()
  4. fetchClass()
  5. fetchRow()

Choose 3 answers

In a general sense, which is more important: performance or maintainability of an application?

  1. Performance first, maintainability second
  2. Maintainability first, performance second
  3. Maintainability
  4. Performance

Choose 1 answers