19 real Gojek interview questions with full model answers — Technical, Behavioral, System design. Drawn from the same verified bank ChannelPulse drills from (19 Gojek questions in total).
1. If you wanted to remove a third-party library from an application, how would you convince your project manager to do so in non-technical terms?
Model answer
Situation — On a mobile app team, I found that a third-party library was adding maintenance and release risk without providing enough value for how little we used it. The project manager cared about delivery dates and customer impact, not the library’s implementation details.
Task — I needed to make the case for removing it in terms of business outcomes, while showing that the change could be made safely and would not derail the roadmap.
Action
I started with the impact rather than the technology: the library was increasing upgrade work, and changes to it could delay app releases or introduce defects. I translated the effort into a simple estimate of engineering time and release risk.
I compared three options: keep it, replace it with a smaller alternative, or use built-in platform capabilities. I included the cost and risks of each, including the one-time migration effort.
I proposed a small proof of concept and a staged rollout. For example, we could migrate one low-risk feature first, verify that customers saw no difference, then remove the dependency from the rest of the app.
I addressed the project manager’s likely concern directly: I suggested scheduling the work alongside related maintenance, setting a time limit, and agreeing on a fallback if the proof of concept exposed unexpected problems.
I presented success measures in plain language: fewer hours spent on upgrades, no increase in crashes or support reports, and no delay to the planned release. I asked for agreement on those measures before asking for the work to be prioritized.
Result — The discussion became a decision about cost, risk, and timing—not a debate about code. In this example, the team approved a small trial, confirmed the feature still worked as expected, and then removed the library in a planned release. I’d report the actual savings and quality results after measuring them; the key lesson is to make the trade-off visible and offer a low-risk way to validate the change.
2. What is your favorite project you’ve ever worked on?
Model answer
Situation — My favorite project was improving the mobile checkout experience for a multi-service app. Users could reach checkout from different journeys, but payment selection and confirmation behaved inconsistently, and the implementation made it hard to introduce new payment options safely.
Task — I wanted to make checkout more predictable for users while giving the team a foundation that could support new payment methods without duplicating flow logic.
Action
I started by mapping the user journey with product, design, and backend partners, including failure cases such as a declined payment, a slow response, and a user returning from an external payment screen.
I helped define a clear separation between checkout state, payment operations, and presentation. That let the UI render explicit loading, success, and recoverable-error states rather than infer them from navigation.
I worked with the team to keep payment-specific behavior behind a small interface, while keeping validation and confirmation rules visible and testable. We avoided over-generalizing before we had multiple real integrations.
I added tests around retries, cancellation, and duplicate taps, and partnered with QA to cover slower network conditions and device lifecycle changes.
I also made sure we instrumented the important steps without logging sensitive payment details, so we could see where users abandoned or encountered errors.
Result — The release improved checkout completion by roughly 5% in the measured cohort and reduced payment-related crash and error reports. More importantly, the next payment integration took less effort because the flow had clear boundaries and failure behavior. I liked this project because it combined user impact, technical design, and close cross-functional work—and because we validated the improvement with data rather than assuming a cleaner architecture was enough.
3. Have you ever done something different that you would like to teach us about?
Model answer
Situation — I noticed that accessibility checks on our mobile team were mostly happening late in QA, even though the app had frequently used flows with custom controls and dynamic content. I had recently learned a more systematic way to include accessibility in everyday development and thought it could help the whole team, not just the feature I was working on.
Task — I wanted to teach a practical approach that engineers could apply during implementation, without turning accessibility into a separate, heavyweight review process.
Action
I prepared a short session using one of our real flows and demonstrated how a screen reader announces its controls, how focus moves, and what happens when text is enlarged.
I showed concrete fixes: meaningful accessibility labels, correct grouping and focus order, sufficient touch targets, and announcements for state changes that are otherwise only visual.
I worked with QA and design to turn the examples into a lightweight checklist. I kept it specific to our components so engineers could use it during code review rather than memorize abstract guidance.
I added a few automated checks for properties we could reliably validate, while explaining that automation does not replace testing with a screen reader or real users.
For a feature with a custom selection control, I paired with its engineer to apply the checklist and used that implementation as a reference example for the team.
Result — The team began catching accessibility issues earlier, and the reference implementation reduced repeated review comments on similar controls. I also learned that teaching works best when it is grounded in the team’s own code and paired with a small, repeatable habit. I’d bring the same approach to other topics: demonstrate a useful technique, make it easy to adopt, and follow up on whether it actually changes the work.
4. What is the most challenging task you’ve ever done?
Model answer
Situation — One of the most challenging tasks I owned was stabilizing a mobile booking flow that had grown difficult to change. The app had several entry points into the flow, and intermittent state-reset bugs were causing users to lose selections; the team was also preparing a release with a tight deadline.
Task — I needed to find the root cause, reduce the risk of regressions, and deliver the fix without pausing other teams that depended on the booking experience.
Action
I first reproduced the issue across entry points and wrote down the expected state transitions. That showed the problem was not one isolated screen: navigation and booking state had become coupled.
I added targeted logging around flow entry, screen transitions, and state restoration. The traces helped distinguish lifecycle issues from backend failures and made the bug reproducible.
I proposed separating flow navigation from screen rendering and making the booking state an explicit dependency. I kept the change incremental rather than rewriting the whole feature, which reduced release risk.
I worked with design and backend partners to agree on which state should survive a retry and which should be reloaded. For example, a selected pickup point could be restored, while an expired quote had to be fetched again.
I added tests for the critical transitions and reviewed the rollout plan with the team. We enabled the change gradually and watched crash rates, flow completion, and support reports.
Result — The fix removed the state-loss issue in the affected flow and reduced related support reports by about 30% over the following release cycle. We shipped on schedule, and the clearer ownership made later changes easier to review. I learned to treat a challenging bug as a system problem: reproducing it and aligning on state ownership mattered as much as writing the fix.
System designMediumGojekSoftware EngineerFirst-round take-home assignment
5. Design and implement a parking lot.
Model answer
1. Requirements & scale
Functional requirements
Register lots, floors, gates, and spots; each spot has a vehicle-size category and operational status.
Admit a vehicle by issuing a ticket and assigning one compatible spot. On exit, calculate the fee, accept payment, and free the spot.
Support lost-ticket handling, cancellations, and operator actions such as closing a spot.
Non-functional requirements
Never assign one spot to two active vehicles; entry and exit must be idempotent.
Keep gate decisions fast and available. If connectivity is lost, gates can use a bounded local mode and reconcile events later.
Provide an audit trail for tickets, payments, and manual overrides.
Estimates: Assume 500 lots × 1,000 spots = 500,000 spots. At 2,000 entries per lot per day, that is 1 million entries/day, or about 12 average requests/second; a 10× peak is roughly 120 requests/second. At about 1 KB per ticket event, ticket data grows by approximately 1 GB/day before indexes and replication. This is modest for a relational database; photos or video are out of scope.
2. High-level architecture
flowchart TD
subgraph Client["Client"]
A["Driver app"]
B["Gate kiosk"]
C["Operator console"]
end
subgraph Edge["Edge / CDN"]
D["API gateway"]
end
subgraph LB["Load Balancer"]
E["Regional router"]
end
subgraph Services["API / Services"]
F["Parking API"]
G["Allocation service"]
H["Payment service"]
end
subgraph Cache["Cache"]
I["Lot config cache"]
end
subgraph DB["Datastores"]
J["PostgreSQL primary"]
K["Read replicas"]
L["Payment provider"]
end
subgraph MQ["Message Queue"]
M["Ticket events"]
end
subgraph Workers["Workers"]
N["Receipt and analytics"]
O["Reconciliation"]
end
A -->|"availability and ticket requests"| D
B -->|"entry and exit commands"| D
C -->|"lot administration"| D
D -->|"HTTPS requests"| E
E -->|"routed requests"| F
F -->|"spot allocation"| G
F -->|"cached lot rules"| I
G -->|"transactional writes"| J
F -->|"read-only queries"| K
F -->|"charge request"| H
H -->|"payment authorization"| L
J -->|"outbox events"| M
M -->|"asynchronous events"| N
M -->|"payment and gate events"| O
Diagram
The gate calls a regional API; the allocation service uses PostgreSQL as the authority for spot ownership. The cache is only for relatively static configuration, never for deciding whether a spot is free.
3. API design
POST /v1/entries — create a ticket and allocate a compatible spot. Require an Idempotency-Key.
GET /v1/tickets/{ticket_id} — retrieve ticket, assigned spot, and current status.
POST /v1/tickets/{ticket_id}/exit-quote — calculate the fee without freeing the spot.
POST /v1/tickets/{ticket_id}/exit — authorize payment and complete exit; idempotent by request key.
GET /v1/lots/{lot_id}/availability — show available capacity by vehicle category.
PATCH /v1/spots/{spot_id} — operator maintenance or status change, with audit metadata.
4. Data model & storage
Use PostgreSQL for transactional allocation and ticket state. Tables: lots, floors, spots, tickets, payments, and outbox_events.
spots contains id, lot_id, category, status, and optional active_ticket_id. Index (lot_id, category, status).
tickets contains id, lot_id, spot_id, vehicle_plate, entry_at, exit_at, state, and idempotency_key. Add a unique constraint on the idempotency key within its lot and a constraint preventing multiple active tickets for a spot.
Keep payment-provider references and status in payments; never store card details. Use an outbox table so a committed ticket change cannot lose its event.
Start with a single highly available PostgreSQL cluster partitioned by lot_id only if data volume warrants it. Replicas serve reports, not allocation decisions.
5. Deep dive
The core problem is allocating a spot exactly once under concurrent arrivals. Keep selection and assignment in one short database transaction. For an entry, choose the best-fit available spot—prefer the smallest category that fits—using row locking, then mark it occupied and create the ticket before committing. FOR UPDATE SKIP LOCKED lets concurrent requests choose different candidates without waiting on the same row. If no compatible spot exists, return a clear “full” response. The database constraint is the final defense against duplicate active assignments.
sequenceDiagram
participant G as Gate
participant A as Parking API
participant D as PostgreSQL
participant P as Payment provider
G->>A: POST entry with idempotency key
A->>D: Begin transaction; lock compatible free spot
D-->>A: Spot selected
A->>D: Create ticket; mark spot occupied; commit
A-->>G: Ticket and spot
G->>A: Request exit quote
A->>D: Read ticket and pricing rules
A-->>G: Fee quote
G->>A: Confirm exit with idempotency key
A->>P: Authorize payment
P-->>A: Payment result
A->>D: Mark ticket paid and closed; free spot
A-->>G: Open gate
Diagram
Entry retries return the original ticket for the same key. For exit, do not free the spot before payment succeeds. If the provider times out, query its idempotency key or reconcile asynchronously rather than charging twice. A pricing service computes fees from entry time, exit time, and the lot’s versioned tariff; store the tariff version on the ticket so later changes do not alter an in-progress stay.
6. Scale, bottlenecks & trade-offs
Replicate the API statelessly across zones; PostgreSQL uses synchronous cross-zone failover where feasible, backups, and tested recovery. Keep allocation writes on the primary to preserve strong consistency.
Partition by lot_id when one cluster becomes a bottleneck; a lot’s spots and tickets remain colocated. A very large lot may need a dedicated shard.
Cache lot rules and read availability from replicas only as an estimate; the entry transaction is authoritative. This trades slightly stale displayed counts for lower read load without risking double allocation.
Payment is an external dependency. Use provider idempotency, timeouts, and a reconciliation worker; define an operational policy for gates when payment status is uncertain.
For network outages, a gate may issue a clearly marked provisional ticket from a locally reserved block of spots. This improves availability but risks over-allocation, so use only with explicit capacity headroom and reconcile before returning to normal mode.
6. What are the different types of access control in Swift?
Model answer
Swift has five access levels, from most to least restrictive:
open — Accessible outside the defining module. Classes and members can also be subclassed or overridden outside that module.
public — Accessible outside the defining module, but a public class or member cannot be subclassed or overridden outside the module unless it is open.
internal — Accessible anywhere within the defining module. This is the default access level.
fileprivate — Accessible anywhere in the same source file.
private — Accessible within the enclosing declaration and, in modern Swift, extensions of that type in the same file.
A module is typically an app target or framework. Access levels also constrain APIs that use other types: for example, a public method cannot expose a type that is less accessible than the method itself.
ARC (Automatic Reference Counting) manages object lifetimes by tracking strong references. When an object has no strong references, ARC deallocates it. Developers still need to prevent retain cycles, usually with weak or unowned references.
Non-ARC is manual reference counting. Code explicitly calls retain, release, and autorelease to manage object lifetimes; failing to balance ownership can cause leaks or use-after-free bugs. ARC is not tracing garbage collection—it inserts ownership-management operations at compile time.
8. If you had to choose between a monolithic repository and multiple repositories, which would you choose, and why?
Model answer
I’d choose a monorepo by default for closely related mobile codebases, provided the team has tooling that keeps builds and ownership manageable. I wouldn’t treat it as a universal rule: repositories should reflect how teams develop, release, and share code.
Why a monorepo can work well for mobile - Shared libraries, design systems, API clients, and app code can evolve together in one reviewed change. That reduces version drift and makes cross-module refactors easier. - Engineers can discover code and run consistent tooling without coordinating releases across several repositories. - A monorepo can support multiple apps and teams if it has clear module boundaries, code ownership, and CI that tests only affected targets.
Costs to plan for - Unoptimized builds and tests can become slow as the repository grows. I’d use build caching, dependency graphs, affected-target testing, and clear module boundaries rather than running every test on every change. - Shared code can create accidental coupling. I’d enforce API boundaries and require owners for critical modules. - Access-control needs can be harder to satisfy when some code must be isolated.
When I’d choose multiple repositories instead - Teams have genuinely independent products, release schedules, and ownership, with little shared code. - There are strong security or access-control boundaries, or repository tooling cannot support the monorepo’s scale. - In that case, I’d publish shared components as versioned packages and establish compatibility and release practices.
flowchart TD
A[Choose repository strategy] --> B{Shared code and coordinated changes?}
B -->|Often| C{Can tooling support fast CI and clear ownership?}
C -->|Yes| D[Use a monorepo]
C -->|No| E[Split by product or team]
B -->|Rarely| F{Independent releases or access boundaries?}
F -->|Yes| G[Use multiple repositories]
F -->|No| D
Diagram
I’d validate the choice against the actual team structure and build pipeline, then revisit it as those change. The goal is not to minimize repository count; it’s to make changes safe, discoverable, and fast to deliver.
The Coordinator pattern moves navigation decisions out of view controllers or screens and into an object responsible for a particular app flow. Instead of a screen creating the next screen and deciding how to present it, it reports an event—such as “user selected a destination”—to its coordinator. The coordinator decides what happens next.
In an iOS app, a root coordinator might own the main navigation controller, while a booking coordinator manages the screens and state for a booking flow. Coordinators can create child coordinators for nested flows, such as choosing a payment method, and remove them when those flows finish.
The main benefits are separation of concerns, more reusable screens, and easier testing of navigation independently from UI rendering. It also helps keep complex flows—like ride booking, checkout, or authentication—from becoming tangled in view controllers. I’d pay particular attention to ownership: a parent should retain a child coordinator while it is active, and the child should signal completion so the parent can release it. Otherwise, it’s easy to create leaks or coordinators that disappear too early.
The pattern adds some structure and objects, so I wouldn’t apply it to every small screen transition. It’s most valuable when navigation is complex, shared across entry points, or needs to be tested and maintained independently.
10. How do you write unit and UI test cases in your current project?
Model answer
I use unit tests for logic that can be tested without rendering the UI, and UI tests for important user journeys and interactions. I aim to make tests deterministic, fast, and useful when they fail.
Choose the right level - Unit-test business rules, validation, state transitions, and view-model or presenter behavior with dependencies replaced by fakes or mocks. - Use UI tests for flows where integration matters, such as completing a booking or handling a failed payment.
Write clear cases - Use the Arrange–Act–Assert pattern and name tests after the behavior, such as showsErrorWhenPaymentFails. - Cover the happy path, meaningful edge cases, and failure states—not every possible permutation.
Keep tests independent - Provide explicit test data, reset state between tests, and avoid relying on test execution order, network services, or real user accounts. - For UI tests, use stable accessibility identifiers and wait for observable conditions rather than fixed sleeps.
Run them continuously - Run focused tests during development and the relevant suite in CI. When a test fails, I investigate whether the product behavior changed, the test has a defect, or the environment is flaky.
flowchart TD
A[Choose behavior] --> B[Write focused test]
B --> C[Run test]
C --> D{Pass?}
D -->|No| E[Fix code or test]
E --> C
D -->|Yes| F[Run suite in CI]
11. What is TDD, and how would you follow it in a project?
Model answer
TDD, or Test-Driven Development, is a development cycle in which I write a test for a small behavior before implementing that behavior. The usual loop is Red–Green–Refactor: see the test fail, make the smallest change that passes it, then improve the design while keeping the tests passing.
Clarify the behavior — I turn a requirement into a specific example, including expected output and relevant edge cases.
Write a failing test — I start at the lowest practical level, commonly a unit test for business logic, and confirm it fails for the intended reason.
Implement the minimum — I add only enough production code to satisfy that behavior.
Refactor safely — I improve names, structure, or duplication while rerunning the tests.
Repeat and integrate — I add cases for important boundaries and failures, then run the relevant suite and CI checks.
flowchart LR
A[Define behavior] --> B[Write failing test]
B --> C[Run test]
C --> D[Implement minimum change]
D --> E[Run tests]
E --> F{All pass?}
F -->|No| D
F -->|Yes| G[Refactor]
G --> E
Diagram
I would use TDD selectively and pragmatically: it works especially well for business rules and state transitions, while exploratory UI work may first need a prototype or clearer requirements. The key is that tests drive small, verifiable steps—not that every line must be written test-first.
12. How does extension memory get associated with the main class being extended?
Model answer
In Objective-C, an extension implemented as a category cannot add stored instance variables to the original class. A common workaround is to attach an associated object using the Objective-C runtime. The runtime stores the value against the target object and a unique key; an association policy determines whether the value is retained, copied, or assigned.
The association is removed when the target object is deallocated. In Swift, extensions likewise cannot add stored properties; associated objects can provide a workaround for Objective-C-runtime-compatible classes, while a subclass or separate composed object is often clearer.
sequenceDiagram
participant C as Category or extension
participant R as Objective-C runtime
participant O as Extended object
C->>R: set associated object with object and key
R->>O: keep association for object lifetime
C->>R: get associated object with object and key
R-->>C: return stored value
O->>R: deallocate
R->>R: release associated value
I write UI tests around user-visible behavior and high-value journeys, rather than trying to duplicate every unit test through the UI.
Core journeys — for example, sign-in, searching for a service, completing a booking, and viewing its status.
Validation and state changes — empty or invalid input, button enabled states, loading indicators, and successful updates.
Failures and recovery — network errors, unavailable services, payment failures, retry behavior, and whether the user’s entered data is preserved.
Navigation and lifecycle-sensitive behavior — moving between screens, returning from a flow, and restoring relevant state after recreation or resume where the platform requires it.
Accessibility and usability checks — key controls are discoverable, labels are meaningful, and important content is not obscured by the keyboard or system UI.
I keep these tests stable by using test data and service fakes where appropriate, selecting elements through accessibility identifiers, and asserting on visible outcomes. I prioritize a small set of reliable end-to-end flows because slow or flaky UI tests can make the whole suite harder to trust.
14. What is the code coverage of your current project?
Model answer
I’d give the current value from the project’s coverage report rather than guess. I’d also clarify what that number measures—for example, line or statement coverage, branch coverage, and whether it is for the whole app or a particular module.
Coverage is useful for spotting untested code, but it is not a measure of test quality by itself. A test can execute a line without checking the expected behavior. I therefore look at coverage alongside critical-flow coverage, meaningful assertions, and whether tests catch regressions.
For a mobile project, I’d generally track coverage for testable business logic and view-model or presenter code, while keeping UI-test coverage as a separate signal. Generated code and framework wiring may need to be excluded or reported separately so the number remains interpretable. I’d use the project’s actual CI report to state the baseline and trend, then focus improvement on high-risk areas rather than chasing an arbitrary percentage.
15. What changed about fileprivate and private before and after Swift 4?
Model answer
Before Swift 4, private was restricted to the lexical scope of its declaration, while fileprivate allowed access throughout the same file. That made fileprivate necessary when a same-file extension needed to use a type's private members.
Swift 4 broadened private: a type's private members can also be accessed by extensions of that type in the same file. fileprivate kept its file-wide meaning, so it is still the choice when unrelated declarations in the same file need access.
struct Account {
private var balance = 0
}
extension Account {
func currentBalance() -> Int {
balance // Allowed in Swift 4 and later.
}
}
16. If you pass a struct to another struct or class, will it create a retain cycle?
Model answer
Passing a struct does not by itself create a retain cycle. Structs are value types, so they are copied semantically when passed; they do not have a strong reference identity like class instances.
However, a struct can contain references to class instances or closures. Those references can participate in a retain cycle if the overall object graph forms a strong-reference loop—for example, a class retains a struct that holds a reference back to that class. In that case, the cycle comes from the references inside the value, not from passing the struct.
17. Should you declare a UILabel property as weak or strong when creating the view in code?
Model answer
For a view created in code, a property that owns the view is typically strong:
private let titleLabel = UILabel()
Add it to the hierarchy with view.addSubview(titleLabel). The superview also retains its subviews, so a weak reference can work while the label is in that hierarchy, but a strong property makes ownership explicit and keeps the label available if it is temporarily removed. Use weak when you intentionally do not want the property to own the view and another object is guaranteed to retain it.
18. Should you declare an IBOutlet as weak or strong when using a storyboard?
Model answer
For a storyboard-created view, an IBOutlet to a view is usually weak:
@IBOutlet weak var titleLabel: UILabel!
The view hierarchy strongly retains its subviews, so the label remains alive while it belongs to the view. A weak outlet also avoids creating an unnecessary ownership relationship. Use strong when the outlet must keep the object alive independently of that hierarchy or when the object is not retained elsewhere; in normal storyboard view hierarchies, weak is the convention.
19. Can you access a fileprivate function or property from a different class in the same file?
Model answer
Yes. A fileprivate function or property is accessible from any code in the same source file, including a different class in that file. It is not accessible from another file, even if that file belongs to the same module.
class First {
fileprivate var token = "abc"
}
class Second {
func read(_ first: First) -> String {
first.token // Allowed: both classes are in the same file.
}
}
Practice these out loud, don't memorise them
Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.