Questions

2 Marks Each

🎯

Test yourself on this topic

8 questions · timed · auto-graded

Question 12 Marks
What is the purpose of rollback()? Write the syntax as well.
Answer
rollback(). It is used to cancel all the changes made to the database, and it only works with DML Statements, i.e. Insert,

Delete or update.

Eg.db.rollback()

View full question & answer
Question 22 Marks
Define programming error and Not supported errors.
Answer
ProgrammingError. Exception raised due to actual programming errors (for example, a table is not found or already exists, there is a syntax error in the MySQL statement, a wrong number of parameters is specified, and so on.).
NotSupportedError. MySQL for Python raises this exception when a method or database API that is not supported is used (for example, requesting a transaction-oriented function when transactions are not available.
View full question & answer
Question 32 Marks
Write the python script to read the content from .csv file (Comma Seperated Values) i.e "Student.csv" and then transfer the content to the SQL Table.
View full question & answer
Question 52 Marks
Write the python script to connect the database, i.e.test and create the table emp21 with the following field (empno,name and salary). Also, insert the row.
View full question & answer
Question 72 Marks
Write the difference between fetchone() and fetchmany() method.
Answer
Fetchone(). It fetches the single record or row from the resultset.

Fetchmany(). This method returns blocks of results according to a set limit.

View full question & answer
Question 82 Marks
How many parameters are required toconnect() method? Name them.
Answer
Four parameters are required for the connectivity. i.e. Hostname, Username, Password and Database name.
View full question & answer
2 Marks Each - Computer Science STD 12 Humanities Questions - Vidyadip