CS FundamentalsVery hardProduct-company API design interview
A public JSON API is used by many clients that ignore unknown fields. How many of these changes are breaking: (1) adding a new optional response field, (2) renaming a response field, (3) making an optional request parameter required, (4) adding a new endpoint, (5) changing a field's type from integer to string, (6) removing an enum value clients may send?
- A. 2
- B. 3
- C. 5
- D. 4
Correct answer: D. 4
Renaming a field, making a parameter required, changing a type and removing an accepted value all break existing clients (4). Adding optional fields or new endpoints is backward compatible when clients tolerate unknown fields.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- In npm's semantic-version ranges, which versions does ^1.4.2 allow, and which does ^0.4.2 allow?
- Two developers run npm install on the same commit a month apart and get different dependency versions, though package.json is unchanged…
- Your app depends on libraries P and Q. P needs utils >=2.0 <3.0 and Q needs utils >=1.2 <2.0. In an ecosystem that allows only one version…
- How many of these refactoring statements are correct? 1. A refactoring must not change the observable behaviour of the code. 2. A good…
- A structure chart shows a date-formatting utility called by 14 modules (high fan-in) and a controller module that calls 23 different…
- A team keeps postponing cleanup of a hard-coded module: each new feature touching it now takes three days instead of one. In the…