Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Google Cloud Certified Professional Cloud Developer · Google Cloud
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
B. Get and put the entity in a transaction. The code provided is updating an account balance in Cloud Datastore. To ensure data integrity and consistency, such an update should be done within a transaction to avoid issues with concurrent updates which could result in an incorrect balance if the account is accessed by multiple processes at the same time.
Put the entity in transaction
B. Get and put the entity in a transaction. It is a good practice to perform a get and put within a transaction to ensure that the update to the balance is atomic. This prevents other processes from reading the balance and making updates to it simultaneously, which could lead to incorrect or inconsistent results. By using a transaction, your teammate can ensure that the balance is updated correctly and consistently.