Bird
0
0

What will be the output of this pseudocode if the service responds in 3 seconds?

medium📝 Analysis Q5 of 15
Microservices - Resilience Patterns
What will be the output of this pseudocode if the service responds in 3 seconds?
try {
  response = callService(timeout=4000)
  print('Response received')
} catch TimeoutException {
  print('Timeout')
}
AError thrown
BTimeout
CNo output
DResponse received
Step-by-Step Solution
Solution:
  1. Step 1: Compare response time with timeout

    Response time is 3 seconds, timeout is 4 seconds, so response arrives before timeout.
  2. Step 2: Execution flow

    No exception occurs, so 'Response received' is printed.
  3. Final Answer:

    Response received -> Option D
  4. Quick Check:

    Response before timeout prints success [OK]
Quick Trick: Response before timeout prints success [OK]
Common Mistakes:
MISTAKES
  • Confusing timeout with response time
  • Assuming timeout triggers anyway
  • Expecting error without exception

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes