Peewee MCQ Questions & Answers
Peewee MCQs : This section focuses on "Peewee" of Python Library. These Multiple Choice Questions (MCQ) should be practiced to improve the Peewee skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Peewee is a Python Object Relational Mapping (ORM) library.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True,Peewee is a Python Object Relational Mapping (ORM) library.
2. Peewee developed by a U.S. based software engineer Charles Leifer in ?
A. 2005
B. 2007
C. 2010
D. 2013
View Answer
Ans : C
Explanation: Peewee was developed by a U.S. based software engineer Charles Leifer in October 2010.
3. Peewee supports?
A. SQLite
B. MySQL
C. PostgreSQL
D. All of the above
View Answer
Ans : D
Explanation: Peewee supports SQLite, MySQL, PostgreSQL and Cockroach databases.
4. ________ is SQLite extension which is used to modify operation of SQLite library.
A. tuple
B. pragma
C. psycopg2
D. pymysql
View Answer
Ans : B
Explanation: pragma is SQLite extension which is used to modify operation of SQLite library.
5. Which method create an alias to the model-class?
A. Classmethod select()
B. Classmethod update()
C. Classmethod alias()
D. classmethod insert()
View Answer
Ans : C
Explanation: Classmethod alias() : Create an alias to the model-class. It allows the same Model to any referred multiple times in a query.
6. Which method Inserts a new row in the underlying table mapped to model?
A. Classmethod select()
B. Classmethod update()
C. classmethod delete()
D. classmethod insert()
View Answer
Ans : D
Explanation: classmethod insert() : Inserts a new row in the underlying table mapped to model.
7. Which class is used to establish foreign key relationship in two models and hence, the respective tables in database?
A. Binary fields
B. ForeignKey field
C. Numeric Field
D. Text fields
View Answer
Ans : B
Explanation: ForeignKeyField : This class is used to establish foreign key relationship in two models and hence, the respective tables in database.
8. The Peewee.Model class also has a ________ method that creates a new instance and add its data in the table.
A. get
B. set
C. create
D. insert
View Answer
Ans : C
Explanation: The Peewee.Model class also has a create() method that creates a new instance and add its data in the table.
9. get_id() instance method returns primary key of a row.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, get_id() Instance method returns primary key of a row.
10. Existing data can be modified by calling?
A. Save
B. Update
C. both a and b
D. None of the above
View Answer
Ans : C
Explanation: Existing data can be modified by calling save() method on model instance as well as with update() class method.
Discussion