DataDriven
LearnPracticeInterviewDiscussDailyJobs

Execution Timer Wrapper

A medium Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.

Domain
Python
Difficulty
medium
Seniority
L6

Interview Prompt

Implement run_timed(fn, args=None). fn is a string of Python lambda source (for example "lambda: 42" or "lambda x, y: x + y") and args is an optional list of positional arguments (default: no arguments). Build the callable from the source string, then wrap it with a timing decorator make_timed that records the start time, calls the function, and measures the elapsed seconds. Invoke the wrapped callable with the supplied positional args and return the original function's return value unchanged. The elapsed time is measured (and may be printed/logged) but is NOT part of the returned value: for "lambda: 42" with no args, return 42; for "lambda x, y: x + y" with args [3, 4], return 7. Handle the no-args case (args is None) by calling the function with zero arguments.

Summary

Function wrapped with a timer. Duration captured on exit.

How This Interview Works

  1. Read the vague prompt (just like a real interview)
  2. Ask clarifying questions to the AI interviewer
  3. Write your python solution with real code execution
  4. Get instant feedback and a hire/no-hire decision

Related

  • All Mock Interviews
  • Practice Mode (untimed)
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Practice Problems
  • Daily Challenge