TN Online TestSamacheer Kalvi practice

12th Standard Computer Science — Python Classes and objects: Additional MCQs with Answers & Explanations

Share this chapter: Telegram

15 extra multiple-choice questions for Python Classes and objects (12th Standard Computer Science, Samacheer Kalvi), beyond the ones printed in the textbook — each with the correct option highlighted and a clear, worked explanation. Free to read in English and Tamil.

Answer key at a glance

Q1
Which keyword is used to define a class in Python?
  • A. Class
  • B. classCorrect
  • C. define
  • D. struct
Explanation. In Python, a class is defined using the lowercase keyword class. It must be followed by a unique class name and a colon.
Q2
What is the process of creating an object or instance of a class known as?
  • A. Class Initialisation
  • B. Class Inheritance
  • C. Class InstantiationCorrect
  • D. Class Implementation
Explanation. The process of creating a new object or instance from an existing class template is called class instantiation.
Q3
Which operator is used to access class variables and methods through an object in Python?
  • A. Arrow operator (->)
  • B. Dot operator (.)Correct
  • C. Scope resolution operator (::)
  • D. Colon operator (:)
Explanation. Python uses the dot (.) operator to access member variables and methods of a class through an instantiated object.
Q4
What must be the first parameter of any method or function defined inside a Python class?
  • A. object
  • B. this
  • C. selfCorrect
  • D. init
Explanation. Every method defined inside a Python class must have self as its first parameter, representing the class instance itself.
Q5
Which special method acts as a constructor in Python classes?
  • A. __init__()Correct
  • B. __new__()
  • C. __constructor__()
  • D. __del__()
Explanation. The special function __init__(), prefixed and suffixed with double underscores, acts as a constructor in Python and executes during instantiation.
Q6
Which of the following correctly describes how a private member variable is declared in a Python class?
  • A. Prefixing the variable name with a single underscore (_)
  • B. Prefixing the variable name with a double underscore (__)Correct
  • C. Suffixed with a double underscore (__)
  • D. Declaring it under a private access specifier block
Explanation. A variable is made private in Python by prefixing its name with a double underscore (__), restricting access to within the class.
Q7
If a private variable __n2 is declared in class Sample, what happens when you try to print it directly from outside the class using object S?
  • A. It prints the value of __n2 successfully.
  • B. It prints None because the variable is private.
  • C. Python throws an AttributeError indicating the object has no such attribute.Correct
  • D. Python throws a NameError indicating the variable is not defined.
Explanation. Private variables cannot be accessed from outside their class environment. Doing so raises an AttributeError in Python.
Q8
How are instance variables defined within a class method in Python?
  • A. Declared directly at the top of the class block.
  • B. Declared inside a method using the self keyword.Correct
  • C. Declared using the global keyword inside a method.
  • D. Declared without any prefix inside the constructor.
Explanation. Instance variables have values unique to each object copy. They are declared inside a method using the self keyword prefix.
Q9
Which special method is used as a destructor in Python to destroy an object?
  • A. __init__()
  • B. __destroy__()
  • C. __del__()Correct
  • D. __exit__()
Explanation. The special method __del__() acts as a destructor in Python. It gets called automatically when an object exits its scope.
Q10
What is the default access control type for variables and methods defined inside a Python class?
  • A. Private
  • B. Protected
  • C. PublicCorrect
  • D. Global
Explanation. By default, all class variables and methods inside a Python class are public and can be accessed from outside the class.
Q11
Consider a class method check(self, num) that takes one parameter in its definition besides self. How many arguments are passed when it is called?
  • A. Zero
  • B. One
  • C. TwoCorrect
  • D. Three
Explanation. The method accepts only one argument during invoking. Python automatically passes the first parameter self, making it two arguments internally.
Q12
According to Python guidelines, how should class variables be accessed when referenced inside a class method?
  • A. Prefixed by the class name and dot operatorCorrect
  • B. Prefixed by the global keyword
  • C. Using the variable name directly without any prefix
  • D. Prefixed with double dollar signs
Explanation. To refer to a class variable within a class method, the variable must be prefixed by the class name and dot operator.
Q13
What happens if a constructor is defined with parameters, and we instantiate the class without passing any arguments?
  • A. Python automatically assigns None to all parameters.
  • B. Python raises a TypeError due to missing required positional arguments.Correct
  • C. Python ignores the parameters and instantiates the object successfully.
  • D. Python prompts the user for inputs at runtime.
Explanation. Instantiating a class invokes its constructor. If arguments are missing for the parameters defined, Python raises a TypeError.
Q14
How can a programmer manually delete an object reference and invoke its destructor in Python?
  • A. Using the del keyword followed by the object nameCorrect
  • B. Calling the __del__() method directly using the object
  • C. Setting the object equal to 0
  • D. Calling the close() method on the object
Explanation. The destructor __del__() can be triggered manually by deleting the reference to the object using Python's del keyword.
Q15
Which of the following is true regarding class variables and instance variables in Python?
  • A. Class variables have separate copies for every object, while instance variables are shared.
  • B. Both class variables and instance variables have separate copies created for every object.
  • C. Both class variables and instance variables are shared across all objects of the class.
  • D. Class variables are shared by all objects of the class, while instance variables are unique to each object.Correct
Explanation. Class variables are shared across all instances of a class, whereas instance variables are recreated with unique copies for each object.
Take the Additional practice test → Open the app

More for this chapter

Book Back Questions10 textbook MCQs · solved Practice TestInteractive · instant score Book Back TestTest yourself on the textbook set Additional MCQ TestTest yourself on the extra set Study NotesConcepts & methods Formula SheetAll key formulas

About these Python Classes and objects questions

These are the Additional multiple-choice questions for Python Classes and objects from the Tamil Nadu State Board (Samacheer Kalvi) 12th Standard Computer Science syllabus. Each question shows the correct option and an original, step-by-step explanation so you understand the method, not just the answer. Use the answer key above to jump to any question, then take the practice test to check yourself under exam-like conditions.

Frequently asked questions

How many MCQs are there in Python Classes and objects?

This chapter has 15 book-back multiple-choice questions, each with the correct answer and a step-by-step explanation.

Are these 12th Standard Computer Science MCQs free to practise online?

Yes. Every question, answer and explanation here is free, and you can also take them as a timed practice test.

Where can I find the Python Classes and objects book-back answers?

The correct option for each question is highlighted on this page with a worked explanation, plus a quick answer-key summary at the top.

More chapters in Computer Science

View all
1 Function 2 Data Abstraction 3 Scoping 4 Algorithmic Strategies 5 Python -Variables and Operators 6 Control Structures 7 Python functions 8 Strings and String manipulation 9 Lists, Tuples, Sets and Dictionary 11 Database Concepts 12 Structured Query Language (SQL) 13 Python and CSV files 14 Importing C++ programs in Python. 15 Data manipulation through SQL 16 Data visualization using pyplot: line chart, pie chart and bar chart