Bird
0
0

What will happen if an iOS app tries to fetch data from a server but the device has no internet connection?

medium📝 Predict Output Q4 of 15
iOS Swift - Networking
What will happen if an iOS app tries to fetch data from a server but the device has no internet connection?
AThe app will automatically connect to a different server
BThe app will receive an error or no response from the server
CThe app will load data from the server instantly
DThe app will crash immediately
Step-by-Step Solution
Solution:
  1. Step 1: Understand network dependency for API calls

    API calls require internet; without it, the app cannot reach the server.
  2. Step 2: Identify expected app behavior without internet

    The app typically gets an error or no response, but does not crash or switch servers automatically.
  3. Final Answer:

    The app will receive an error or no response from the server -> Option B
  4. Quick Check:

    No internet = error/no response [OK]
Quick Trick: No internet means API calls fail with errors [OK]
Common Mistakes:
  • Assuming automatic server switching
  • Expecting instant data without connection
  • Thinking app crashes on network failure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes