0% found this document useful (0 votes)
81 views22 pages

Modularity and Oop in Python

This document provides a summary of key concepts related to modularity, object-oriented programming (OOP), and Python. It begins with an introduction to data collection types in Python like lists and tuples. It then covers key OOP concepts such as classes, objects, constructors, and methods. The document provides examples of Python code demonstrating lists, methods, and classes. It concludes with a quiz reviewing these Python and OOP concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views22 pages

Modularity and Oop in Python

This document provides a summary of key concepts related to modularity, object-oriented programming (OOP), and Python. It begins with an introduction to data collection types in Python like lists and tuples. It then covers key OOP concepts such as classes, objects, constructors, and methods. The document provides examples of Python code demonstrating lists, methods, and classes. It concludes with a quiz reviewing these Python and OOP concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

MODULARITY AND OOP IN

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

Clicking on Correct answer will Take you to next Slide


automatically
Q2.Which of the following are the key
features of an OOP Language?

Constructor and Constructor and Object


Classes

Classes and Object Constructor and


Destructor
Q3. Functions defined inside the class:

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?

class class_name class class_name<>

class class_name: class class_name[]


Q14. Let setA={3,6,9}, setB={1,3,9}. What will be the result of the following snippet?
print (setA|setB)

{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?

Symmetric Difference Difference

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

You might also like