Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Try/Catch, CAP Theorem, and Internals
00:00
5 left

Try/Catch, CAP Theorem, and Internals

HardPython

Problem

How the try, catch, except, finally worked. How the method set is build under the hood. Explain the CAP theorem and endless list of questions like this.

Implement analyze_runtime to model these concepts deterministically. Return each declared class's C3 method resolution order, the exception trace, whether the exception was handled, and whether the selected CAP properties are simultaneously valid.

Input parameters are JSON-compatible dictionaries, strings or null, lists of handler objects, and a string cleanup action. Return a JSON-compatible dictionary.

Constraints

  • 1 <= len(classes) <= 100
  • Each class has at most 10 direct bases
  • The inheritance graph is a valid acyclic hierarchy
  • Handler objects contain string keys type and action
  • handlers are evaluated from left to right
  • cap_properties contains values from consistency, availability, and partition_tolerance

Function Signature

def analyze_runtime(classes, exception_type, handlers, finally_action, cap_properties):
Interviewer

Your question is Try/Catch, CAP Theorem, and Internals. 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
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.