PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Software Engineering Fundamentals/Coinbase

Debug and Extend Cursor Queries

Last updated: May 5, 2026

Quick Overview

This question evaluates proficiency in debugging iterator/cursor semantics, designing incremental-query features (limit/order_by/pagination), conducting code reviews for correctness and performance, and diagnosing concurrency-related correctness issues in an in-memory database.

  • hard
  • Coinbase
  • Software Engineering Fundamentals
  • Software Engineer

Debug and Extend Cursor Queries

Company: Coinbase

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Onsite

You are working in an AI-assisted coding interview. You may consult AI-generated suggestions, but you must validate them, explain your reasoning, and share your screen while you work. You are given a small in-memory database abstraction. A table is a list of rows, where each row is a dictionary from column name to value. Queries return a cursor object that supports incremental iteration. A simplified implementation is shown below: ```python class Cursor: def __init__(self, rows): self.rows = rows self.index = 0 def has_next(self): self.index += 1 return self.index < len(self.rows) def next(self): if not self.has_next(): return None return self.rows[self.index] class Table: def __init__(self): self.rows = [] def insert(self, row): self.rows.append(row) def query(self, predicate=lambda row: True): return Cursor([row for row in self.rows if predicate(row)]) ``` Answer the following four parts: 1. **Bug finding:** Identify the cursor iteration bug or bugs, explain the expected cursor semantics, and fix the implementation. 2. **New feature design:** Add support for one of the following features and describe the design: `limit(n)`, `order_by(column)`, or pagination with a stable resume token. 3. **Pull request review:** Review an AI-generated change that eagerly copies all rows on every query and stores mutable row references in the cursor. What correctness, performance, and maintainability concerns would you raise? 4. **Production debugging:** Suppose users report that some paginated queries return duplicate rows or skip rows while writes are happening concurrently. Explain how you would investigate, reproduce, instrument, and fix the issue.

Quick Answer: This question evaluates proficiency in debugging iterator/cursor semantics, designing incremental-query features (limit/order_by/pagination), conducting code reviews for correctness and performance, and diagnosing concurrency-related correctness issues in an in-memory database.

Related Interview Questions

  • Design a task management system with TTL - Coinbase (medium)
  • Implement a blog feed with fetching and state - Coinbase (medium)
  • Implement a Reusable Dropdown Component - Coinbase (hard)
Coinbase logo
Coinbase
Apr 2, 2026, 12:00 AM
Software Engineer
Onsite
Software Engineering Fundamentals
1
0

You are working in an AI-assisted coding interview. You may consult AI-generated suggestions, but you must validate them, explain your reasoning, and share your screen while you work.

You are given a small in-memory database abstraction. A table is a list of rows, where each row is a dictionary from column name to value. Queries return a cursor object that supports incremental iteration.

A simplified implementation is shown below:

class Cursor:
    def __init__(self, rows):
        self.rows = rows
        self.index = 0

    def has_next(self):
        self.index += 1
        return self.index < len(self.rows)

    def next(self):
        if not self.has_next():
            return None
        return self.rows[self.index]

class Table:
    def __init__(self):
        self.rows = []

    def insert(self, row):
        self.rows.append(row)

    def query(self, predicate=lambda row: True):
        return Cursor([row for row in self.rows if predicate(row)])

Answer the following four parts:

  1. Bug finding: Identify the cursor iteration bug or bugs, explain the expected cursor semantics, and fix the implementation.
  2. New feature design: Add support for one of the following features and describe the design: limit(n) , order_by(column) , or pagination with a stable resume token.
  3. Pull request review: Review an AI-generated change that eagerly copies all rows on every query and stores mutable row references in the cursor. What correctness, performance, and maintainability concerns would you raise?
  4. Production debugging: Suppose users report that some paginated queries return duplicate rows or skip rows while writes are happening concurrently. Explain how you would investigate, reproduce, instrument, and fix the issue.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Coinbase•More Software Engineer•Coinbase Software Engineer•Coinbase Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
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.