HTTP JSON APIs interview questions
API Versioning, Jackson ObjectMapper, JSON Serialization
27 questions with answers and explanations · 27 flashcards
Questions
- When defining API versioning strategies, what is a key benefit of using URL paths over HTTP headers?Multiple choiceMedium
- Why might an API client crash if JSON response shapes are not treated as strict contracts?Multiple choiceMedium
- Why might you choose to use an API gateway in conjunction with API versioning?Multiple choiceMedium
- In the context of Java's HttpClient, which method allows you to perform an asynchronous HTTP request?Multiple choiceMedium
- How can you ensure that a Java application using HttpClient does not suffer from resource exhaustion during network failures?Multiple choiceHard
- Why should an API version change when a field is renamed or removed?Multiple choiceHard
- Which of the following is a challenge when using URL path versioning for APIs?Multiple choiceHard
- What should the DTO-to-domain translation step usually do?Multiple choiceMedium
- Which of the following HTTP client timeout configurations is crucial for preventing resource exhaustion in a Java application?Multiple choiceMedium
- Which JSON mapping strategy is recommended for maintaining backward compatibility when updating an API?Multiple choiceEasy
- Which of the following is a non-breaking change when updating a JSON API?Multiple choiceEasy
- Why do teams use CompletableFuture for handling multiple asynchronous HTTP requests in Java in production code?Multiple choiceMedium
- What does the Jackson ObjectMapper class primarily assist with in Java applications?Multiple choiceEasy
- In an e-commerce application, how can using CompletableFuture improve the handling of multiple asynchronous HTTP requests?Multiple choiceMedium
- In Java's HttpClient, which method converts a synchronous request into an asynchronous one?Multiple choiceMedium
- When using Jackson's ObjectMapper, which annotation ensures that unexpected fields in a JSON response do not cause deserialization errors?Multiple choiceEasy
- How does using HTTP headers for API versioning provide flexibility?Multiple choiceHard
- Why is it essential to treat JSON response shapes as strict contracts?Multiple choiceMedium
- In the context of JSON APIs, what does it mean to treat response shapes as strict contracts?Multiple choiceEasy
- Why can using HTTP headers for API versioning become a problem in production code?Multiple choiceHard
- Which approach should be used to handle a breaking change in a JSON API response to avoid client crashes?Multiple choiceHard
- In API versioning, what is a potential drawback of using URL path versioning?Multiple choiceMedium
- Which strategy is most suitable for handling breaking changes in a JSON API without affecting existing clients?Multiple choiceHard
- When adding a new field to a JSON API response, which of the following strategies is the safest for backward compatibility?Multiple choiceEasy
- Why translate external JSON into boundary DTOs before domain objects?Multiple choiceEasy
- Why does the Jackson ObjectMapper class in Java matter in this design?Multiple choiceEasy
- How can you ensure an API client handles unexpected additional fields in a JSON response?Multiple choiceMedium