Bird
0
0

A developer wrote this code to calculate GB-seconds: total_gb_seconds = invocations * execution_time_ms * memory_mb. What is wrong with this calculation?

medium📝 Debug Q6 of 15
GCP - Cloud Functions
A developer wrote this code to calculate GB-seconds: total_gb_seconds = invocations * execution_time_ms * memory_mb. What is wrong with this calculation?
ANothing is wrong
BMemory should be in MB, not GB
CInvocations should be divided by 1000
DExecution time should be in seconds, not milliseconds
Step-by-Step Solution
Solution:
  1. Step 1: Check units for execution time

    Execution time must be in seconds for GB-seconds calculation, not milliseconds.
  2. Step 2: Verify memory units

    Memory should be converted from MB to GB by dividing by 1024 or 1000 depending on context.
  3. Final Answer:

    Execution time should be in seconds, not milliseconds -> Option D
  4. Quick Check:

    Convert ms to seconds before multiplying [OK]
Quick Trick: Always convert ms to seconds before calculating GB-seconds [OK]
Common Mistakes:
  • Using milliseconds directly in calculation
  • Confusing MB and GB units
  • Not converting units consistently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes