0
0
GCPcloud~20 mins

State management in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
State Management Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
How does Cloud Storage maintain state for object versions?

Google Cloud Storage can keep multiple versions of the same object. What happens when you enable versioning on a bucket and upload a new file with the same name?

AThe new upload creates a new version of the object, keeping the old version accessible.
BThe new upload overwrites the existing object and deletes the old version permanently.
CThe bucket rejects the upload because the object name already exists.
DThe new upload merges the content with the existing object automatically.
Attempts:
2 left
💡 Hint

Think about how versioning helps you recover old files.

Architecture
intermediate
2:00remaining
Choosing state storage for a Cloud Run service

You have a Cloud Run service that processes user requests. It needs to keep user session data between requests. Which storage option is best to maintain state across multiple instances?

AUse Cloud SQL to store session data persistently.
BStore session data in Cloud Run instance memory (RAM).
CWrite session data to a local file on the Cloud Run container.
DUse environment variables to store session data.
Attempts:
2 left
💡 Hint

Remember that Cloud Run instances can scale and restart anytime.

security
advanced
2:00remaining
Securing state data in Firestore

You store user preferences in Firestore. How can you ensure only the user can read and write their own preferences?

AEncrypt data on the client side and store encrypted blobs without rules.
BStore all preferences in a public collection with no security rules.
CUse IAM roles to grant all users read/write access to the Firestore database.
DUse Firestore security rules to allow read/write only if request.auth.uid matches the document ID.
Attempts:
2 left
💡 Hint

Think about how Firestore rules can restrict access based on user identity.

Configuration
advanced
2:00remaining
Configuring Memorystore for Redis for session state

You want to use Memorystore for Redis to store session state for a GKE cluster. Which configuration is required to allow GKE nodes to connect securely to Memorystore?

ADeploy Memorystore in a different project without VPC peering.
BExpose Memorystore with a public IP and whitelist GKE node IPs.
CCreate Memorystore in the same VPC network as GKE and allow private IP access.
DUse Memorystore with no network configuration; it is accessible by default.
Attempts:
2 left
💡 Hint

Consider network security and private connectivity.

Best Practice
expert
3:00remaining
Designing state management for a multi-region app

You design a multi-region web app on GCP that requires low-latency access to user state globally. Which approach best balances consistency and performance?

AUse a single regional Cloud Spanner instance and route all requests there.
BUse multi-region Cloud Spanner with strong consistency and automatic replication.
CStore state in local instance memory and sync periodically with a central database.
DUse Firestore in native mode with multi-region replication and eventual consistency.
Attempts:
2 left
💡 Hint

Think about global consistency and replication features.