Check sibling questions

A resultset is extracted from the database using the cursor object (that has been already created) by giving the following statement. 

Mydata=cursor.fetchone() 

(a) How many records will be returned by the fetchone() method? 

Answer

One record

Explanation: fetchone() method returns a single record or None if no more rows are available .

 

(b) What will be the datatype of Mydata object after the given command is executed? 

Answer

tuple

Explanation: By default fetchone() method retrieves the result set as tuple , since tuple items are stored in a single variable and the items are ordered , unchangeable , and allows duplicate values .

983 students joined Teachoo Black. What are you waiting for?

Davneet Singh's photo - Teacher, Engineer, Marketer

Made by

Davneet Singh

Davneet Singh is a graduate from Indian Institute of Technology, Kanpur. He has been teaching from the past 12 years. He provides courses for Maths and Science at Teachoo.