PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Bloomberg

Design a packet reassembler API

Last updated: Apr 19, 2026

Quick Overview

This question evaluates API design, stream-oriented buffer management, stateful packet assembly, input validation, concurrency control, testing strategy, and time/space complexity reasoning.

  • medium
  • Bloomberg
  • System Design
  • Software Engineer

Design a packet reassembler API

Company: Bloomberg

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Design a PacketAssembler API that accepts streaming fragments and emits a completed payload once enough bytes have been received. Example interaction: packetit(0x04, 'a', 'b', 'c') -> no output (header 4 indicates total size; only 3 bytes arrived); packetit('d') -> 'abcd' (completes the prior packet). Specify the class/method signatures, state management (buffering and expected size), behavior for multiple consecutive packets, handling of invalid headers or oversized input, when/if state resets after emission, and thread-safety considerations. Provide tests and analyze time and space complexity.

Quick Answer: This question evaluates API design, stream-oriented buffer management, stateful packet assembly, input validation, concurrency control, testing strategy, and time/space complexity reasoning.

Related Interview Questions

  • Design streaming mention analytics with search and alerts - Bloomberg (hard)
  • Design a Global Marketing Email Platform - Bloomberg (medium)
  • Design a fair event registration queue API - Bloomberg (medium)
  • Design in-memory trade subscription processor - Bloomberg (medium)
  • Explain Kafka partitions and delivery semantics - Bloomberg (hard)
Bloomberg logo
Bloomberg
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
9
0

Design a PacketAssembler API for Streaming Fragments

Context and Assumptions

  • You are building a small component that assembles packets from a byte stream.
  • Each packet begins with a 1-byte header that encodes the payload length N (0–255). The header byte is not part of the payload.
  • The stream may arrive fragmented arbitrarily; a single call may contain parts of a packet or multiple full packets back-to-back.

Example interaction:

  • packetit(0x04, 'a', 'b', 'c') -> no output (header 4 indicates a 4-byte payload; only 3 bytes arrived)
  • packetit('d') -> 'abcd' (completes the prior packet)

Requirements

  1. Specify the class and method signatures of a PacketAssembler API.
  2. Describe state management: buffering, expected size, and how fragments are handled.
  3. Behavior when receiving multiple consecutive packets within one or many calls.
  4. Handling of invalid headers and oversized input (e.g., header value exceeds a configured maximum).
  5. Define when/how state resets after emission and on errors.
  6. Thread-safety considerations and options.
  7. Provide tests (unit-style examples) that exercise common and edge cases.
  8. Analyze time and space complexity.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Bloomberg•More Software Engineer•Bloomberg Software Engineer•Bloomberg System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ 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.