This Python Class Quiz covers the core concepts of OOP in Python, such as class creation, objects, constructors, attributes, and methods. Learn how Python classes help structure code using real-world objects.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which keyword is used to define a class in Python?
Correct
Incorrect
Question 2 of 15
2. Question
What does a class represent in Python?
Correct
Incorrect
Question 3 of 15
3. Question
What is the output of the following code?
class A: def show(self):
print(“Hello”) obj = A()
obj.show()
Correct
Incorrect
Question 4 of 15
4. Question
What is the first argument of every instance method in a class?
Correct
Incorrect
Question 5 of 15
5. Question
Which method is called automatically when an object is created?
Correct
Incorrect
Question 6 of 15
6. Question
How do you access class variables from inside a method?
Correct
Incorrect
Question 7 of 15
7. Question
What is the output of this code?
class A: x = 10 print(A.x)
Correct
Incorrect
Question 8 of 15
8. Question
Can a class have multiple methods?
Correct
Incorrect
Question 9 of 15
9. Question
Which of the following creates an object of class Student?
Correct
Incorrect
Question 10 of 15
10. Question
What is the output of this code?
class Test: def __init__(self): self.val = 5 t = Test() print(t.val)
Correct
Incorrect
Question 11 of 15
11. Question
What will type(obj) return?
class Demo: pass obj = Demo() print(type(obj))
Correct
Incorrect
Question 12 of 15
12. Question
Can a class inherit from another class in Python?
Correct
Incorrect
Question 13 of 15
13. Question
Which method is used to return a string representation of an object?
Correct
Incorrect
Question 14 of 15
14. Question
What will happen if a class has no __init__() method?
Correct
Incorrect
Question 15 of 15
15. Question
What is self in Python classes?
Correct
Incorrect
Summary
These Python Class MCQs help learners strengthen their understanding of object-oriented programming, including class structure, object instantiation, methods, attributes, and constructors. This knowledge is essential for real-world software development.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.