Questions

M.C.Q

🎯

Test yourself on this topic

13 questions · timed · auto-graded

MCQ 11 Mark
Data Error exception raised when:
  • A
    When no data exist.
  • B
    raised due to problems with the processed data
  • C
    When object unable to store the data returned by the cursor object,
  • numeric value out of range, or division by zero occur.
Answer
Correct option: D.
numeric value out of range, or division by zero occur.
View full question & answer
MCQ 31 Mark
Method for closing the connection with database is:
  • Close()
  • B
    Stop()
  • C
    Rollback()
  • D
    Exit()
Answer
Correct option: A.
Close()
Close()
View full question & answer
MCQ 41 Mark
Complete the code:

  • A
    MySQLDB and connection
  • MySQLdb and connect
  • C
    MYSQL and connect
  • D
    MySQLdb and connector
Answer
Correct option: B.
MySQLdb and connect
MySQLdb and connect
View full question & answer
MCQ 51 Mark
Exception raised when the relational integrity of the database is affected in Python
  • A
    IntegrityFailError
  • IntegrityError
  • C
    IntegrityViolationError
  • D
    Integrityfatalerror
Answer
Correct option: B.
IntegrityError
View full question & answer
MCQ 61 Mark
Which method of cursor class is used to execute database function or stored procedure in Python
  • A
    cursor.callprocedure('procedureName' , [parameters,])
  • B
    cursor.callproc('procedureName', [parameters,])
  • cursor.callfunc('procedureName', [parameters,])
  • D
    cursor.calldef('procrdureName',[parameter])
Answer
Correct option: C.
cursor.callfunc('procedureName', [parameters,])
cursor.callfunc('procedureName', [parameters,])
View full question & answer
MCQ 71 Mark
Which method is used to retrieve the executed database function or stored procedure result in Python
  • cursor.stored_results()
  • B
    cursor.get_results()
  • C
    cursor.fetch_results()
  • D
    cursor.new_results()
Answer
Correct option: A.
cursor.stored_results()
cursor.stored_results()
View full question & answer
MCQ 81 Mark
Which method of cursor class is used to get the number of rows affected after any of the insert/update/delete database operation executed from Python
  • A
    cursor.rowcount
  • B
    cursor.getaffectedcount
  • cursor.rowscount
  • D
    cursor.fetchcount
Answer
Correct option: C.
cursor.rowscount
cursor.rowscount
View full question & answer
MCQ 91 Mark
Which method is used to Commit pending transaction to the database in Python?
  • connection.commit()
  • B
    cursor.commit()
  • C
    cursor.rollback()
  • D
    cursor.savepoint()
Answer
Correct option: A.
connection.commit()
connection.commit()
View full question & answer
MCQ 101 Mark
Which method of cursor class is used to insert or update multiple rows using a single query
  • cursor.executemany(query, rows)
  • B
    cursor.execute(query, rows)
  • C
    cursor.executmultiple(query, rows)
  • D
    cursor.multipleexeucte(query,row)
Answer
Correct option: A.
cursor.executemany(query, rows)
cursor.executemany(query, rows)
View full question & answer
MCQ 111 Mark
Which method of cursor class is used to fetch limited rows from the table:
  • A
    cursor.fetchsize(SIZE)
  • cursor.fetchmany(SIZE)
  • C
    cursor.fetchonly(SIZE)
  • D
    cursor.fetchone()
Answer
Correct option: B.
cursor.fetchmany(SIZE)
cursor.fetchmany(SIZE)
View full question & answer
MCQ 121 Mark
Mandatory arguments required to connect any database from Python>
  • A
    Username, Password, Hostname, Database Name, Port.
  • B
    Username, Password, Hostname
  • Username, Password, Hostname, Database Name
  • D
    Username, Hostname, Databasename
Answer
Correct option: C.
Username, Password, Hostname, Database Name
Username, Password, Hostname, Database Name
View full question & answer
MCQ 131 Mark
Which method is used to get the row-id of the last modified row
  • A
    cursor.getrowid
  • B
    cursor.endrowid
  • cursor.lastrowid
  • D
    cursor.setworwid
Answer
Correct option: C.
cursor.lastrowid
cursor.lastrowid
View full question & answer
M.C.Q - Computer Science STD 12 Science Questions - Vidyadip