Code Execution Verifier for Programming Benchmarks
Text Generation & NLP Evaluation DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding Secure Code Execution and Sandboxing for Evaluation, Subprocess Pipe Redirection, Signal-based Timeouts, AST Node Traversal, Standard Output Buffering, Exit Code Validation, Software Engineering, Operating Systems, Computer Security, Compiler Design, Distributed Systems, Sandboxing, Process Management, AST Parsing, Resource Throttling, Remote Procedure Calls.
Implement a secure execution wrapper that takes a string of Python code, executes it within a restricted environment, and captures the standard output. Ensure the function handles potential infinite loops using a timeout and returns a controlled error message if execution fails or exceeds constraints.