Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Multiple Inheritance in Python
00:00
5 left

Multiple Inheritance in Python

MediumPython

Problem

Implement a small claim review component for Chubb's claims workflow using multiple inheritance. The reviewer must combine secure claim storage with audit tracking, while keeping the access code private through Python name mangling.

Create these classes:

  1. SecureClaim: accepts a claim ID and access code in its constructor. Store the access code in a private instance variable named __access_code. Provide a method that verifies a supplied code without exposing the stored value.
  2. AuditTrail: maintains an events list and provides a method for recording review events.
  3. ClaimReview: inherits from both AuditTrail and SecureClaim. Its constructor must pass the access code to SecureClaim and initialize the audit state. Its review method should authorize the claim and record exactly one event.

Implement process_claim(claim_id, amount, access_code, supplied_code). It must create a ClaimReview, review the claim, and return a dictionary with claim_id, status, and audit_count. A claim is approved only when the supplied code matches the private access code and the amount is at most 10000. Otherwise, its status is rejected.

Constraints

  • 1 <= len(claim_id) <= 30
  • 0 <= amount <= 1000000
  • Access codes and supplied codes are non-empty strings of at most 50 characters
  • The returned dictionary must not contain the private access code

Function Signature

def process_claim(claim_id, amount, access_code, supplied_code):
Interviewer

Your question is Multiple Inheritance in Python. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.