← eBay Interview Insights

eBay·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

eBay software engineer interview with a bitmap block management question. Pretty implementation-heavy for a phone screen, they wanted a full test driver not just the algorithm.

Questions Asked (1)

Q1

You're given a BitmapBlock class with methods to allocate contiguous blocks, search for free runs, and count fragmentation holes. Write a test driver that exercises the class end-to-end, including failure scenarios like overlapping allocations and a fully-allocated bitmap. Walk through what edge cases your driver covers.

Algorithms & Data StructuresTechnical Trade-offsSystem Design
Author's notes

The part that tripped me up wasn't the happy path, it was they specifically wanted failure cases woven in.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by outlining a test driver structure that covers normal allocation, edge cases like full bitmap and overlapping allocations, and fragmentation scenarios. Then, describe specific test cases and expected outcomes, emphasizing boundary conditions and error handling. Conclude by discussing how you would verify correctness and maintainability.

Pro tip: Demonstrate maturity by discussing not just what to test but also how to structure tests for readability and reuse, and mention the importance of testing failure modes as rigorously as success paths.

1. Understand the BitmapBlock API

Review the methods: allocate contiguous blocks, search for free runs, and count fragmentation holes. Identify inputs, outputs, and error conditions.

2. Design test driver structure

Plan a modular test driver with setup, teardown, and helper functions. Use a test framework or simple assertions to validate outcomes.

3. Enumerate test scenarios

List normal cases (e.g., allocate a block, search for free runs) and edge cases (e.g., allocate when full, overlapping allocations, zero-size allocation, fragmentation counting).

4. Implement and execute tests

Write code for each scenario, including expected results. Run tests and handle any failures or exceptions.

5. Analyze coverage and edge cases

Walk through the edge cases covered, explain why they matter, and discuss any additional scenarios you might add.

Key Points to Mention

  • Boundary conditions: allocating exactly the remaining free blocks, allocating zero blocks, allocating more than available.
  • Overlapping allocations: attempting to allocate a block that is already allocated, ensuring the method returns an error or false.
  • Fully-allocated bitmap: searching for free runs returns none, allocation fails gracefully.
  • Fragmentation holes: creating a fragmented bitmap and verifying the count matches expected holes.
  • Error handling: ensuring methods return appropriate error codes or throw exceptions for invalid inputs.
  • Test isolation: each test should start with a clean bitmap to avoid dependencies.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.