PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/OpenAI

Parse and build binary data in Python

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in binary data handling and serialization/deserialization in Python, including little-endian integer encoding, length-prefixed payloads, robust error handling for short reads and invalid lengths, and testability and performance considerations.

  • Medium
  • OpenAI
  • Data Manipulation (SQL/Python)
  • Software Engineer

Parse and build binary data in Python

Company: OpenAI

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

Using provided interfaces ByteReader(read(n), read_uint32_le, read_string) and ByteWriter(write(b), write_uint32_le, write_string), implement functions to pack and unpack messages for a simple binary protocol: message = {id:uint32 LE, payload_len:uint32 LE, payload:bytes}. Write parse_message(reader)->Message and build_message(writer, Message)->None with error handling for short reads, invalid lengths, and overflow. Avoid printing for debugging; design tests instead, and explain how you would verify correctness and performance.

Quick Answer: This question evaluates proficiency in binary data handling and serialization/deserialization in Python, including little-endian integer encoding, length-prefixed payloads, robust error handling for short reads and invalid lengths, and testability and performance considerations.

Related Interview Questions

  • Write SQL for repeat churn - OpenAI (hard)
  • Handle repeated churn in SQL - OpenAI (hard)
  • Compute churn with re-subscriptions - OpenAI (hard)
  • Debug and harden trial-assignment Python code - OpenAI (Medium)
  • Write SQL for post-trial conversion cohorts - OpenAI (Medium)
OpenAI logo
OpenAI
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Data Manipulation (SQL/Python)
6
0

Using provided interfaces ByteReader(read(n), read_uint32_le, read_string) and ByteWriter(write(b), write_uint32_le, write_string), implement functions to pack and unpack messages for a simple binary protocol: message = {id:uint32 LE, payload_len:uint32 LE, payload:bytes}. Write parse_message(reader)->Message and build_message(writer, Message)->None with error handling for short reads, invalid lengths, and overflow. Avoid printing for debugging; design tests instead, and explain how you would verify correctness and performance.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More OpenAI•More Software Engineer•OpenAI Software Engineer•OpenAI Data Manipulation (SQL/Python)•Software Engineer Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.