Networking interview questions
Asynchronous HTTP, HttpClient Basics, Jackson ObjectMapper, JSON Serialization, Socket Programming, Timeouts and Retries
127 questions with answers and explanations · 127 flashcards
Questions (page 1 of 3)
- How does an HttpClient distinguish between client and server errors?Multiple choiceEasy
- What does the HttpClient.newHttpClient() method do?Multiple choiceEasy
- Why is it useful to configuring FAIL_ON_UNKNOWN_PROPERTIES to false in Jackson's ObjectMapper?Multiple choiceEasy
- How would you explain a common issue when using ObjectMapper to deserialize nested JSON objects into Java classes in an interview?Multiple choiceHard
- What happens if you attempt to deserialize a JSON array into a Java class with Jackson and FAIL_ON_UNKNOWN_PROPERTIES is set to true?Multiple choiceHard
- Why is it important to set timeouts on HTTP requests?Multiple choiceMedium
- How would you explain a potential benefit of using CompletableFuture.supplyAsync to fetch data from multiple API endpoints in parallel in an interview?Multiple choiceMedium
- How would you explain a key consideration when using Jackson's ObjectMapper to deserialize JSON from a public API in an interview?Multiple choiceHard
- What is one of the roles of the @JsonIgnore annotation in Jackson?Multiple choiceEasy
- Which design consideration is crucial for handling JSON payloads in large-scale Java applications?Multiple choiceMedium
- Which method can be used to handle exceptions that occur during a CompletableFuture's execution?Multiple choiceHard
- Which of the following is an advantage of using CompletableFuture for network calls in Java?Multiple choiceMedium
- How does CompletableFuture.supplyAsync differ from runAsync?Multiple choiceMedium
- How can you specify a custom timeout for a request using HttpClient?Multiple choiceMedium
- How can you safely handle a network call timeout using HttpClient in Java?Multiple choiceHard
- How can you configure Jackson's ObjectMapper to serialize a Java record into a JSON string?Multiple choiceMedium
- Why is it beneficial to use JSON serialization when working with HTTP APIs?Multiple choiceEasy
- Why is using plain string manipulation to handle JSON API responses often considered problematic?Multiple choiceEasy
- In the context of API versioning, what is a common strategy when introducing breaking changes?Multiple choiceHard
- Which annotation would you use in Jackson to change the name of a field during serialization?Multiple choiceMedium
- When using Jackson, how can you ensure a field is only serialized if it has a non-null value?Multiple choiceHard
- In the context of parallel HTTP requests, how does CompletableFuture.allOf improve performance?Multiple choiceHard
- Which approach ensures that CompletableFutures complete in the order they were started?Multiple choiceHard
- How would you explain a key characteristic of the java.net.http.HttpClient when handling asynchronous requests in an interview?Multiple choiceMedium
- Why do teams use HttpClient's sendAsync method in production code?Multiple choiceEasy
- How can you ensure a CompletableFuture computation times out if it takes too long?Multiple choiceMedium
- How would you explain a key advantage of using CompletableFuture for handling asynchronous HTTP requests in a Java interview?Multiple choiceHard
- Why can incorrectly setting a very high timeout in HttpClient become a problem in production code?Multiple choiceHard
- In Java's HttpClient, which method is used to build the client instance before making requests?Multiple choiceEasy
- Why does the @JsonFormat annotation in Jackson matter in practice?Multiple choiceEasy
- Which Java package is primarily used for handling HTTP operations in modern applications?Multiple choiceEasy
- How does setting an excessively high timeout value in HttpClient affect application behavior?Multiple choiceHard
- What method can you use to deserialize a JSON string into a Java object using ObjectMapper?Multiple choiceEasy
- Which CompletableFuture method allows handling exceptions during asynchronous computation?Multiple choiceMedium
- Which method on CompletableFuture allows you to handle exceptions during asynchronous computation?Multiple choiceMedium
- What does the term 'API versioning' refer to in RESTful services?Multiple choiceEasy
- When making an HTTP GET request using HttpClient, which method of HttpRequest is typically used?Multiple choiceEasy
- Which library is used for JSON serialization and deserialization in Java?Multiple choiceEasy
- How can API versioning be effectively managed in a RESTful service?Multiple choiceHard
- Which Jackson annotation allows you to ignore a specific field during serialization?Multiple choiceEasy
- How would you explain a potential risk of not setting a timeout in network requests in an interview?Multiple choiceHard
- When dealing with API versioning, which strategy ensures backward compatibility while introducing new features?Multiple choiceHard
- When is sendAsync with CompletableFuture especially useful?Multiple choiceMedium
- How can you configure the ObjectMapper to handle a JSON input with unknown properties gracefully?Multiple choiceMedium
- Why does setting ObjectMapper's FAIL_ON_UNKNOWN_PROPERTIES to false change runtime behavior?Multiple choiceEasy
- Why can not using CompletableFuture for asynchronous tasks become a problem in practice?Multiple choiceMedium
- In which scenario would using CompletableFuture.allOf be most beneficial?Multiple choiceMedium
- In which scenario would using CompletableFuture with HttpClient offer a significant advantage?Multiple choiceHard
- How does CompletableFuture improve the performance of network requests in Java applications?Multiple choiceMedium
- Why do teams use HttpClient's sendAsync method for network requests in production code?Multiple choiceEasy