HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Quizzes
  2. /Three classes are written first. Then each line below is added, on its own, after them. Which of these lines run without raising an exception? Choose every correct option.
Python ProgrammingAdvancedHigh School (11–12)Python Going Further › Inheritance and Special MethodsPCAP (Python Institute)
+2 more exams
A-LevelIB
A-LevelIBPCAP (Python Institute)
StemPy LabCreated by StemPy Lab

Three classes are written first. Then each line below is added, on its own, after them. class A: pass class B(A): pass class C(A): pass Which of these lines run without raising an exception? Choose every correct option.

One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.

Log in to save
← All Quizzes
← A parent and a child class each have a private class variable with the same name. What does the program print?A class inherits from the built-in list and adds a method that returns the object. What does the program print? →
More onPython Going Further › Inheritance and Special Methods

Discussion (0)

Log in to join the discussion.

Loading…

More questions on this topic

  1. Three classes form a chain. Each one sets its own rate, and Premium extends the cost method with…Hard
  2. A class defines __add__ but not __iadd__. A second name points to the first object before += is…Hard
  3. A thermometer reading should turn into text through its own special method. The method gives back…Hard
  4. The class Plane has two base classes, Wing and Tail. Both set the class variable mark, and only…Hard
  5. A list holds a Shape, a Circle and a number. The program counts its objects in two different ways.…Hard
All questions on this topic →

Problems on this topic

  1. For each pair, say whether you would use inheritance (is a) or composition (has a), and why…Easy
  2. A class Note has an attribute rupees. Write __lt__ and __str__ so that sorted puts a list of notes…Medium
  3. For each line of code, name the special method that Python calls…Easy
  4. The loop below works for any animal. Add a class Bird that says Tweet, and a class Parrot built on…Medium
All problems on this topic →