IntermediateTECHNICAL
Suppose your REST API for a multi-tenant SaaS app needs to support both web and mobile clients, with features like pagination, filtering, and partial updates. How would you design the endpoints, handle versioning, and prevent common issues such as over-fetching/under-fetching, N+1 queries, and inconsistent error handling? Be specific about patterns and techniques you’d use.
Full Stack Developer
General

Sample Answer

I’d design tenant-scoped resources (e.g., /v1/tenants/{tenantId}/projects) with cursor-based pagination (?cursor=…&limit=50) and whitelistable filters/sorts (?status=active&sort=-createdAt). For partial updates, I’d use PATCH with JSON Merge Patch or JSON Patch, validating allowed fields per role. To prevent over/under-fetching, I’d support sparse fieldsets and includes (fields=basic&include=owner) while keeping responses under a target size (e.g., <100KB). On the data layer (Node.js + TypeORM/Prisma), I’d use eager loading with SELECT IN or dataloader-style batching to avoid N+1 and add composite indexes on tenantId + foreign keys. Versioning is URI-based (/v1, /v2) with deprecation headers. Errors follow a consistent envelope (status, code, message, details, correlationId) mapped from typed exceptions. This approach has cut N+1-related queries by ~70% and reduced average payload size by ~40% in prior projects.

Keywords

Tenant-scoped REST endpoints with cursor-based pagination and controlled filtering/sortingPATCH for partial updates with JSON (Merge/Patch) and strict validation/authorizationSparse fieldsets and includes to control over-fetching/under-fetching and payload sizeAvoid N+1 with eager loading/batching and enforce consistent error envelope and versioning
Related Questions

Based on your hydrology and irrigation engineering background, explain how you would estimate the irrigation water requirement for a kharif crop in a semi-arid region of Gujarat. Walk me through each step: from reference evapotranspiration estimation, crop coefficient selection, effective rainfall calculation, to arriving at canal discharge for a given command area.

IntermediateTECHNICAL

In your civil engineering studies, what specific design coursework or project work did you complete related to irrigation channels or canals (e.g., design of lined/unlined canals, distributaries, minors)? Describe one such design in detail, including how you determined discharge, permissible velocity, section dimensions, and lining choice for Gujarat-type soil and climate conditions.

IntermediateTECHNICAL

Walk me through a recent multi-channel digital marketing campaign you managed end-to-end. How did you set objectives, choose channels, allocate budget, and measure success?

IntermediateBEHAVIORAL

In your resume you note improving or optimizing [a process, KPI, or metric]. What specific baseline metrics did you start from, what steps did you personally take, and how did you verify that the improvement was due to your changes rather than external factors?

IntermediatePROBLEM_SOLVING

On your resume you mention working on a cross-functional project (e.g., involving multiple teams or stakeholders). Describe a situation from that project where priorities conflicted—how did you navigate the trade-offs and what was the final outcome?

IntermediateSITUATIONAL