← eBay Interview Insights

eBay·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

eBay coding round for a software engineer role, basically one meaty question about implementing and testing a bitmap block allocator. The question had more layers than I expected once they started asking about edge cases.

Questions Asked (1)

Q1

You're given a BitmapBlock class that manages a fixed-size bitmap of allocation slots with methods to allocate contiguous blocks, find free contiguous blocks, and count fragmentation holes. Write a test driver (main function) that exercises the class end-to-end, including failure cases like overlapping allocations and a fully-allocated bitmap. Then explain what edge cases your driver covers.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I spent too long on the happy path and nearly forgot to test the failure cases until they nudged me.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by outlining the test driver's structure: a main function that sequentially tests normal allocation, failure cases (overlapping, out-of-space), and fragmentation counting. Then, for each test, describe the expected behavior and how you would verify it, emphasizing edge cases like boundary conditions and full allocation.

Pro tip: Demonstrate thoroughness by including tests for zero-size allocations, allocations that exactly fit remaining space, and fragmentation after freeing blocks—these show you think beyond the obvious.

1. Understand the BitmapBlock API

Review the class methods: allocate contiguous blocks, find free contiguous blocks, and count fragmentation holes. Know their parameters, return values, and side effects.

2. Design test scenarios

Plan a sequence of tests covering: successful allocation, allocation failure due to insufficient contiguous space, overlapping allocation attempt, and full bitmap. Also include fragmentation counting after allocations and frees.

3. Implement the driver

Write a main function that creates a BitmapBlock instance, performs the planned operations, and checks results (e.g., return values, bitmap state) using assertions or printed output.

4. Explain edge cases covered

After presenting the driver, articulate which edge cases are tested and why they matter, such as boundary conditions, zero-size requests, and fragmentation scenarios.

Key Points to Mention

  • Testing both success and failure paths for allocation
  • Verifying that overlapping allocations are rejected
  • Checking behavior when bitmap is fully allocated
  • Validating fragmentation hole count after various operations
  • Including boundary cases like allocating exactly the remaining free space
  • Considering zero-size allocation requests

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