← BNSF Interview Insights

BNSF·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Coding round for a software engineer role at BNSF. Two tasks back to back: build a REST API with some quirky plain-text input requirements, then write unit tests for a function you can't even see the source of. Weird combo but kind of interesting once you got into it.

Questions Asked (2)

Q1

Implement a basic REST API for a simple resource (like a note or message) that supports create, read, update, and delete. The request body uses plain text instead of JSON, but all responses must be JSON with appropriate HTTP status codes. Handle edge cases like missing resources and bad input.

API & IntegrationsSystem DesignTechnical Trade-offs
Author's notes

The plain-text body thing tripped me up at first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints, then outline the API endpoints and their HTTP methods, status codes, and response formats. Explain how you'll parse plain text request bodies and validate input, and describe how you'll handle edge cases like missing resources and bad input. Finally, discuss any trade-offs or design decisions, such as using a simple in-memory store versus a database.

Pro tip: Mention that you'll use appropriate HTTP status codes (e.g., 201 for creation, 400 for bad input, 404 for missing resources) and ensure responses are consistently JSON, even for errors. Also, highlight the importance of idempotency for PUT and DELETE operations.

1. Clarify requirements and constraints

Ask clarifying questions about the resource, expected request/response formats, authentication, persistence, and any specific edge cases. Confirm that request bodies are plain text and responses are JSON.

2. Design the API endpoints

Define RESTful endpoints for CRUD operations: POST /notes (create), GET /notes/{id} (read), PUT /notes/{id} (update), DELETE /notes/{id} (delete). Specify the expected request body (plain text) and response body (JSON) for each.

3. Handle request parsing and validation

Explain how you'll read the plain text body, validate it (e.g., non-empty, length limits), and handle malformed input. For example, return 400 Bad Request with a JSON error message if the body is invalid.

4. Implement CRUD logic and edge cases

Describe the logic for each operation, including generating unique IDs, storing data (e.g., in-memory map), and handling missing resources (return 404). Ensure responses include appropriate status codes and JSON payloads.

5. Discuss trade-offs and extensions

Mention trade-offs like using an in-memory store for simplicity versus a database for persistence, and how you'd handle concurrency. Also, suggest possible extensions like pagination or authentication.

Key Points to Mention

  • Use of proper HTTP methods and status codes (e.g., 200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Internal Server Error).
  • Parsing plain text request bodies and validating input (e.g., checking for empty or oversized content).
  • Consistent JSON response format, including error responses with a message field.
  • Handling missing resources by returning 404 with a JSON error message.
  • Idempotency of PUT and DELETE operations.
  • Choice of data storage (in-memory vs. database) and its implications for scalability and persistence.

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

Q2

Write unit tests for a function when you only have its specification, not the actual implementation code. Cover as many meaningful scenarios as possible including edge cases and failure modes.

Technical Trade-offsAlgorithms & Data Structures
Author's notes

This one is genuinely harder than it sounds.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by thoroughly analyzing the specification to identify inputs, outputs, and expected behavior. Then systematically design test cases covering normal cases, edge cases, and failure modes, using equivalence partitioning and boundary value analysis. Finally, structure your answer by walking through the test cases you would write, explaining your reasoning and how you would handle ambiguities in the spec.

Pro tip: Demonstrate maturity by acknowledging that specs are often incomplete or ambiguous; propose clarifying questions and suggest writing tests that document assumptions, which can later be validated with the implementer.

1. Understand the Specification

Read the spec carefully to identify the function's contract: inputs, outputs, preconditions, postconditions, and any constraints. Note any ambiguities or missing details that need clarification.

2. Identify Test Scenarios

Brainstorm categories of test cases: normal/expected inputs, edge cases (boundaries, empty, null, extreme values), and failure modes (invalid inputs, exceptions, error handling).

3. Design Test Cases

For each scenario, define specific inputs and expected outputs. Use techniques like equivalence partitioning, boundary value analysis, and decision tables to ensure coverage.

4. Structure and Prioritize Tests

Organize tests into logical groups (e.g., by functionality or input type). Prioritize based on risk and likelihood of failure, ensuring critical paths are covered first.

5. Document Assumptions and Ambiguities

Clearly state any assumptions made due to spec gaps. Suggest how to handle them (e.g., ask for clarification, write tests that can be easily adjusted).

Key Points to Mention

  • Equivalence partitioning and boundary value analysis to systematically cover inputs.
  • Handling of edge cases such as empty inputs, null values, maximum/minimum values, and type mismatches.
  • Failure modes: invalid inputs, exceptions, error codes, and graceful degradation.
  • Test doubles (mocks/stubs) if the function interacts with external dependencies.
  • Test readability and maintainability: descriptive test names, arrange-act-assert structure.
  • Coverage metrics (e.g., branch coverage) and how to ensure meaningful coverage without over-testing.

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