The method cursor() is used in Python-MySQL connectivity applications. This…
2023
The method cursor() is used in Python-MySQL connectivity applications. This method is a member of :
- A.
sql module
- B.
pickle module
- C.
database-connectivity module
- D.
csv module
Attempted by 1071 students.
Show answer & explanation
Correct answer: C
Explanation: The cursor() method is provided by database connectivity modules that follow the DB-API standard. It is a method of the connection object and returns a cursor object used to execute SQL queries and retrieve results from the database.
Examples: mysql.connector, pymysql
Typical usage: call conn.cursor() to obtain a cursor, then use cursor.execute(query) and cursor.fetchall() or cursor.fetchone() to get results.
Note: The cursor() method is not part of standard modules like sql, pickle, or csv. It is specific to database connectivity libraries.