Q1)Which of the following does the for loop iterate on?
a) Iterable
b)Condition
c) Both a and b
d)None of the above
Q2) Which of the following can be used as keys for dictionaries?
a)Lists
b)Tuples
c)Sets
d) dictionaries
Q3) Which of the following built-in methods/functions try to modify a dictionary?
a) Keys
b)cmp
c)sorted
d) fromkeys
Q4) The ability of one class to acquire methods and attributes of another class is called ____.
a)Abstraction
b)Inheritance
c)Polymorphism
d)Encapsulation
Q5) What is the output of the below code?
Code
>>> class Audio:
>>> def use(self):
>>> print(“To listen”)
>>> class Video:
>>> def use(self):
>>> print(“To see”)
>>> class Movie(Audio, Video):
>>> def use(self):
>>> super().use()
>>> m1 = Movie()
>>> m1.use()
a) To listen
b)To see
c)Both A and B
d)AttributeError
Q6) Which of the following statement(s) is/are true?
Statement 1: Multiple Inheritance allows a class to inherit multiple classes.
Statement 2: A combination of two or more types of inheritance is called Hybrid Inheritance.
a)Statement 1 is true
b)Statement 2 is true
C)Both statements are true
d)None of the statements are true