Modularity and Oop in Python
Modularity and Oop in Python
PYTHON
Prepared by
M. SHENBAGAVALLI
Pedagogy of Computer
Science
For,
XII Standard
Q1. Pick odd one in connection with
collection data type
List Tuples
Dictionary Loop
Functions Module
Methods Sections
Q4. Let L1=[2,4,6,8,10],then
print(L1[-2]) will result in:
10 8
4 6
Q5. Members are accessed through which operator:
& . (dot)
# %
Q6. Which of the following function is used to count the
number of elements in a List?
count () find ()
len () index ()
Q7. Which of the following method is automatically
executed when an object is created?
__object__ () __del__ ()
__func __ () __init__()
Q8. If L1=[10,20,30,40,50] then
L1[2]=35 will result
[35,10,20,30,40,50] [10,20,30,40,50,35]
[10,20,35,40,50] [[10,35,30,40,50]
Q9. A Private class variable is prefixed with
__ &&
## **
Q10. Which of the following Python function can be used
to add more than one element within an existing list?
append () append_more ()
extend () more ()
Q11. Which of the following method is used as
destructor?
__init__ () __dest__ ()
__rem__ () __del__ ()
Q12. What will be result of the following Python code?
S=[x**2 for x in range(5)]
print(S)
[0,1,2,4,5] [0,1,4,9,16]
[0,1,4,9,16,25] [1,4,9,16,25]
Q13. Which of the following class declaration is correct?
{3,6,9,1,3,9} {3,9}
{1} {3,6,9,1}
Q15.Which of the following is the output of the following program?
class Student:
def__init__(self,name)
self.name=name
print(name)
S=Student(“Tamil”)
Error Tamil
name self
Q16.Which of the following set operation includes all the elements
that are in two sets but not the one that are common to two sets?
Intersection Union
Q17. Which of the following is private class variable
__num ##num
$$num &&num
Q18. The keys in Python, dictionary is specified by
= ;
+ :
Q19. The process of creating an object is called as:
Constructor Destructor
Initialize Instantiation
Answers for all the questions
1. Loop 11. __del__ ()
2. Classes and Objects 12. [0,1,4,9,16]
3. Methods 13. class class_name:
4. 8 14. {3,6,9,1}
5. .(dot) 15. Tamil
6. count () 16. Symmetric Difference
7. __init__() 17. __num
8. [10,20,35,40] 18. :
9. __ 19. Instantiation
10. extend ()
THANK YOU
&
ALL THE BEST