Skip to content
Sharp

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)

  1. How does an HttpClient distinguish between client and server errors?Multiple choiceEasy
  2. What does the HttpClient.newHttpClient() method do?Multiple choiceEasy
  3. Why is it useful to configuring FAIL_ON_UNKNOWN_PROPERTIES to false in Jackson's ObjectMapper?Multiple choiceEasy
  4. How would you explain a common issue when using ObjectMapper to deserialize nested JSON objects into Java classes in an interview?Multiple choiceHard
  5. 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
  6. Why is it important to set timeouts on HTTP requests?Multiple choiceMedium
  7. 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
  8. How would you explain a key consideration when using Jackson's ObjectMapper to deserialize JSON from a public API in an interview?Multiple choiceHard
  9. What is one of the roles of the @JsonIgnore annotation in Jackson?Multiple choiceEasy
  10. Which design consideration is crucial for handling JSON payloads in large-scale Java applications?Multiple choiceMedium
  11. Which method can be used to handle exceptions that occur during a CompletableFuture's execution?Multiple choiceHard
  12. Which of the following is an advantage of using CompletableFuture for network calls in Java?Multiple choiceMedium
  13. How does CompletableFuture.supplyAsync differ from runAsync?Multiple choiceMedium
  14. How can you specify a custom timeout for a request using HttpClient?Multiple choiceMedium
  15. How can you safely handle a network call timeout using HttpClient in Java?Multiple choiceHard
  16. How can you configure Jackson's ObjectMapper to serialize a Java record into a JSON string?Multiple choiceMedium
  17. Why is it beneficial to use JSON serialization when working with HTTP APIs?Multiple choiceEasy
  18. Why is using plain string manipulation to handle JSON API responses often considered problematic?Multiple choiceEasy
  19. In the context of API versioning, what is a common strategy when introducing breaking changes?Multiple choiceHard
  20. Which annotation would you use in Jackson to change the name of a field during serialization?Multiple choiceMedium
  21. When using Jackson, how can you ensure a field is only serialized if it has a non-null value?Multiple choiceHard
  22. In the context of parallel HTTP requests, how does CompletableFuture.allOf improve performance?Multiple choiceHard
  23. Which approach ensures that CompletableFutures complete in the order they were started?Multiple choiceHard
  24. How would you explain a key characteristic of the java.net.http.HttpClient when handling asynchronous requests in an interview?Multiple choiceMedium
  25. Why do teams use HttpClient's sendAsync method in production code?Multiple choiceEasy
  26. How can you ensure a CompletableFuture computation times out if it takes too long?Multiple choiceMedium
  27. How would you explain a key advantage of using CompletableFuture for handling asynchronous HTTP requests in a Java interview?Multiple choiceHard
  28. Why can incorrectly setting a very high timeout in HttpClient become a problem in production code?Multiple choiceHard
  29. In Java's HttpClient, which method is used to build the client instance before making requests?Multiple choiceEasy
  30. Why does the @JsonFormat annotation in Jackson matter in practice?Multiple choiceEasy
  31. Which Java package is primarily used for handling HTTP operations in modern applications?Multiple choiceEasy
  32. How does setting an excessively high timeout value in HttpClient affect application behavior?Multiple choiceHard
  33. What method can you use to deserialize a JSON string into a Java object using ObjectMapper?Multiple choiceEasy
  34. Which CompletableFuture method allows handling exceptions during asynchronous computation?Multiple choiceMedium
  35. Which method on CompletableFuture allows you to handle exceptions during asynchronous computation?Multiple choiceMedium
  36. What does the term 'API versioning' refer to in RESTful services?Multiple choiceEasy
  37. When making an HTTP GET request using HttpClient, which method of HttpRequest is typically used?Multiple choiceEasy
  38. Which library is used for JSON serialization and deserialization in Java?Multiple choiceEasy
  39. How can API versioning be effectively managed in a RESTful service?Multiple choiceHard
  40. Which Jackson annotation allows you to ignore a specific field during serialization?Multiple choiceEasy
  41. How would you explain a potential risk of not setting a timeout in network requests in an interview?Multiple choiceHard
  42. When dealing with API versioning, which strategy ensures backward compatibility while introducing new features?Multiple choiceHard
  43. When is sendAsync with CompletableFuture especially useful?Multiple choiceMedium
  44. How can you configure the ObjectMapper to handle a JSON input with unknown properties gracefully?Multiple choiceMedium
  45. Why does setting ObjectMapper's FAIL_ON_UNKNOWN_PROPERTIES to false change runtime behavior?Multiple choiceEasy
  46. Why can not using CompletableFuture for asynchronous tasks become a problem in practice?Multiple choiceMedium
  47. In which scenario would using CompletableFuture.allOf be most beneficial?Multiple choiceMedium
  48. In which scenario would using CompletableFuture with HttpClient offer a significant advantage?Multiple choiceHard
  49. How does CompletableFuture improve the performance of network requests in Java applications?Multiple choiceMedium
  50. Why do teams use HttpClient's sendAsync method for network requests in production code?Multiple choiceEasy