Menu

Objective Type Questions & Answers


Python Programming -Unit-5 Objective Type Questions



1. Mandatory arguments required to connect any database from Python

A . Username, Password, Hostname, Database Name, Port.

B . Username, Password, Hostname

C . Username, Password, Hostname, Database Name

D . Username, Password

Answer


2. Which method of cursor class is used to insert or update multiple rows using a single query?

A . cursor.executemany(query, rows)

B . cursor.execute(query, rows)

C . cursor.executmultiple(query, rows)

D . cursor.executAll(query, rows)

Answer


3. Which method is used to Commit pending transaction to the database in Python?

A . connection.commit()

B . cursor.commit()

C . connection.cursor.commit()

D . commit()

Answer


4. Which of the following code snippets creates and connects to a new MySQL Database?

A . conn=MySQLdb.connect(host="localhost",user="root",pwd="root",databse="Sampledb")

B . conn=MySQLdb.connect("localhost","root","root","Sampledb")

C . conn=MYSQLDB.connect("localhost","root","root","Sampledb")

D . conn=connect("localhost","root","root","Sampledb")

Answer


5. Which of the following is valid Cursor methods used to retrieve all rows  as query results?

A . cursor.execute ()

B . cursor.fetchall()

C . cursor.fecthone()

D . cursor.run()

Answer


6. What is the type of the results variable in the following code snippet?
 cursor.execute("SELECT * FROM People")
results = cursor.fetchall()

A . tuple

B . dictionary

C . list

D . set

Answer


7. In Object Relational Mapping (ORM) database table treated as ____________ ?

A . Object

B . Method

C . Class

D . Variable

Answer


8. In Object Relational Mapping (ORM) data in table is mapped with ____________ ?

A . Object

B . Class

C . Method

D . Variable

Answer


9. In Object Relational Mapping (ORM) ___________ function is used to create engine?

A . createengine()

B . engine()

C . create_engine()

D . create()

Answer


10. The Correct Syntax for create engine in SQLALchemy with MySQL _______________

A . create_engine(`mysql+mysqlconnector://root:root@localhost/Collegedb`)

B . create_engine(`mysqlmysqlconnector://root:root@localhost/Collegedb`)

C . create_engine(`mysql:mysqlconnector://:root@localhost/Collegedb`)

D . create_engine(`mysql+mysqlconnector://:@localhost/Collegedb`)

Answer


11. What is the use of session object in SQLALchemy?

A . To Insert

B . To Update

C . To Delete

D . All The Above

Answer


12. Which method of session object is used to insert multiple rows at a time in SQLALchemy?

A . add()

B . update()

C . add_all()

D . All the above

Answer


13. Which method of session object is used to select rows from database table in SQLALchemy?

A . add()

B . query()

C . update()

D . add_all()

Answer


14. Which method of session object is used to select rows from database table with condition in SQLALchemy?

A . execute()

B . query()

C . filter()

D . add_all()

Answer


15. Which synchronization method is used to guard the resources with limited capacity, e.g. a database server?

A . Condition

B . Lock

C . Event

D . Semaphore

Answer


16. Which method of cursor class is used to fetch limited rows from the table?

A . cursor.fetchsize(SIZE)

B . cursor.fetchmany(SIZE)

C . cursor.fetchonly(SIZE)

D . cursor.fetchall(SIZE)

Answer




Relevant Materials :

Python Programming -Unit-1 Objective Type Questions - [ Python Programming ]

Python Programming -Unit-2 Objective Type Questions - [ Python Programming ]

Python Programming -Unit-3 Objective Type Questions - [ Python Programming ]

Python Programming -Unit-4 Objective Type Questions - [ Python Programming ]

Python Programming -Unit-5 Objective Type Questions - [ Python Programming ]


Similar Materials :

R - Programming MCQs - Unit-1 - [ R-Programming ]

R - Programming MCQs - Unit-2 - [ R-Programming ]

R - Programming MCQs - Unit-3 - [ R-Programming ]

R - Programming MCQs - Unit-4 - [ R-Programming ]

R - Programming MCQs - Unit-5 - [ R-Programming ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-1 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-2 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-3 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-4 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-5 - [ FLAT ]

PPS MCQs - Unit-1 - [ PPS ]

PPS MCQs - Unit-2 - [ PPS ]

PPS MCQs - Unit-3 - [ PPS ]

PPS MCQs - Unit-4 - [ PPS ]

PPS MCQs - Unit-5 - [ PPS ]

Object Oriented Programming through Java MCQs - Unit-1 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-2 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-3 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-4 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-5 - [ OOP_JAVA ]

Design and Analysis of Algorithms MCQs - Unit-1 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-2 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-3 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-4 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-5 - [ DAA ]

Software Engineering MCQs - Unit-1 - [ SE ]

Software Engineering MCQs - Unit-2 - [ SE ]

Software Engineering MCQs - Unit-3 - [ SE ]

Software Engineering MCQs - Unit-4 - [ SE ]

Software Engineering MCQs - Unit-5 - [ SE ]

Data Mining MCQs - Unit-1 - [ DM ]

Data Mining MCQs - Unit-2 - [ DM ]

Data Mining MCQs - Unit-3 - [ DM ]

Data Mining MCQs - Unit-4 - [ DM ]

Data Mining MCQs - Unit-5 - [ DM ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-1 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-2 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-3 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-4 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-5 - [ COA ]

Data Structures Objective Type Question Bank-Unit-1 - [ DS ]

Data Structures Objective Type Question Bank-Unit-2 - [ DS ]

Data Structures Objective Type Question Bank-Unit-3 - [ DS ]

Data Structures Objective Type Question Bank-Unit-4 - [ DS ]

Data Structures Objective Type Question Bank-Unit-5 - [ DS ]

Database Management System Objective Type Question Bank-Unit-1 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-2 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-3 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-4 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-5 - [ DBMS ]