Q
What is the primary purpose of the PDO::exec() method in PHP PDO extension?

Answer & Solution

Answer: Option B
Solution:
The PDO::exec() method in PHP PDO extension is primarily used for executing an SQL query that does not return a result set, such as INSERT, UPDATE, DELETE, or CREATE statements.
Related Questions on Average

Which of the following PHP functions is used to execute an SQL query in PDO extension?

A). pdo_execute()

B). pdo_query()

C). pdo_fetch()

D). pdo_prepare()

Which of the following SQL operations is used to update existing data in a database table?

A). INSERT

B). SELECT

C). UPDATE

D). DELETE

What is the purpose of the mysqli_close() function in PHP?

A). Establishing a database connection

B). Executing SQL queries

C). Fetching data from the database

D). Closing the database connection

Which of the following SQL operations is used to remove all data from a database table?

A). INSERT

B). SELECT

C). TRUNCATE

D). DELETE

Which of the following SQL operations is used to insert new data into a database table?

A). INSERT

B). SELECT

C). UPDATE

D). DELETE

What is the purpose of the mysqli_fetch_object() function in PHP?

A). Establishing a database connection

B). Executing SQL queries

C). Fetching data from the database

D). Closing the database connection

What is the primary function of the mysqli_fetch_array() function in PHP?

A). Establishing a database connection

B). Executing SQL queries

C). Fetching data from the database

D). Closing the database connection

What is the purpose of the mysqli_fetch_assoc() function in PHP?

A). Establishing a database connection

B). Executing SQL queries

C). Fetching data from the database

D). Closing the database connection

Which of the following statements is true regarding SQL SELECT operation?

A). It updates existing records in a table

B). It removes specific records from a table

C). It adds new records to a table

D). It retrieves data from a table

Which PHP extension provides procedural and object-oriented approaches for executing SQL queries and interacting with MySQL databases?

A). PDO

B). MySQL

C). SQLI

D). MySQLi