Search Header Logo

Python Classes and Objects MCQ on 13.2.2025

Authored by Dr. 2397

Computers

12th Grade

Used 1+ times

Python Classes and Objects MCQ on 13.2.2025
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax to define a class in Python?

class: ClassName()

define class ClassName()

class ClassName[]:

class ClassName: pass

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create an object from a class in Python?

You create an object by calling the class: my_object = MyClass()

You create an object by importing the class: from my_module import MyClass

You create an object by defining a variable: my_object = 'MyClass'

You instantiate an object using the new keyword: my_object = new MyClass()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a class method in Python?

To modify instance attributes directly

To create new instances of the class

To define instance-specific behavior

The purpose of a class method is to operate on the class itself rather than on instances of the class.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you access attributes of an object in Python?

Use dot notation (object.attribute) or getattr(object, 'attribute').

Use square brackets (object[attribute])

Call the attribute directly (object.attribute())

Access attributes using the object.get(attribute) method

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a class method and an instance method?

Class methods require an instance of the class to be called.

Class methods operate on the class level, while instance methods operate on the instance level.

Class methods can only be called from within the class itself.

Instance methods can modify class-level attributes directly.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?