Bird
Raised Fist0
Firebasecloud~20 mins

Firebase services overview - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Firebase Services Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Firebase Realtime Database behavior
Which statement best describes how Firebase Realtime Database handles data synchronization across clients?
AIt synchronizes data in real-time by pushing updates to all connected clients instantly.
BIt requires clients to poll the server periodically to get the latest data updates.
CIt only synchronizes data when the client manually requests an update.
DIt synchronizes data only when the app restarts or reconnects to the network.
Attempts:
2 left
💡 Hint
Think about how Firebase keeps multiple users' data consistent without delay.
❓ Architecture
intermediate
2:00remaining
Choosing Firebase Storage for media files
You want to store user-uploaded images and videos securely and serve them efficiently in your app. Which Firebase service is best suited for this purpose?
AFirebase Realtime Database
BFirebase Cloud Firestore
CFirebase Authentication
DFirebase Storage
Attempts:
2 left
💡 Hint
Consider which service is designed for large binary files like images and videos.
❓ service_behavior
advanced
2:00remaining
Firebase Cloud Functions trigger behavior
What happens when a Firebase Cloud Function is triggered by a Firestore document write event?
AThe function runs once for every document write event and can modify other documents or perform backend tasks.
BThe function runs only once when the Firestore database is created.
CThe function runs continuously in the background regardless of events.
DThe function runs only when manually invoked from the Firebase console.
Attempts:
2 left
💡 Hint
Think about event-driven backend code that reacts to database changes.
❓ security
advanced
2:00remaining
Firebase Authentication security best practice
Which practice best improves security when using Firebase Authentication in your app?
ADisable email verification to speed up user sign-up.
BStore user passwords in Firestore for easy access.
CUse Firebase Authentication's built-in methods and avoid storing passwords manually.
DAllow anonymous sign-in without any restrictions.
Attempts:
2 left
💡 Hint
Think about how to keep user credentials safe and avoid risks.
✅ Best Practice
expert
3:00remaining
Optimizing Firestore queries for cost and performance
You want to minimize Firestore costs and improve query speed when retrieving user data filtered by age and city. Which approach is best?
ARun two separate queries: one filtering by age and another by city, then merge results in the app.
BCreate a composite index on age and city fields and use a single query with both filters.
CRetrieve all user documents and filter by age and city in the app code.
DUse Firebase Realtime Database instead of Firestore for complex queries.
Attempts:
2 left
💡 Hint
Think about how Firestore indexes affect query efficiency and cost.

Practice

(1/5)
1. Which Firebase service helps you manage user sign-in and identity verification easily?
easy
A. Analytics
B. Firestore
C. Authentication
D. Hosting

Solution

  1. Step 1: Understand Firebase services purpose

    Authentication is designed to handle user sign-in and identity verification.
  2. Step 2: Match service to function

    Firestore is for database, Hosting is for web hosting, Analytics is for tracking usage.
  3. Final Answer:

    Authentication -> Option C
  4. Quick Check:

    User sign-in = Authentication [OK]
Hint: User sign-in? Think Authentication service [OK]
Common Mistakes:
  • Confusing Firestore with Authentication
  • Thinking Hosting manages users
  • Mixing Analytics with sign-in
2. Which of the following is the correct way to initialize Firebase Hosting in your project?
easy
A. firebase init hosting
B. firebase start hosting
C. firebase deploy hosting
D. firebase create hosting

Solution

  1. Step 1: Recall Firebase CLI commands

    To set up Hosting, you first initialize it with firebase init hosting.
  2. Step 2: Differentiate commands

    firebase deploy hosting deploys but does not initialize; others are invalid commands.
  3. Final Answer:

    firebase init hosting -> Option A
  4. Quick Check:

    Initialize Hosting = firebase init hosting [OK]
Hint: Init means setup, so use 'firebase init hosting' [OK]
Common Mistakes:
  • Using deploy before init
  • Using non-existent commands
  • Confusing start with init
3. What will the following Firebase code snippet do?
const db = firebase.firestore();
db.collection('users').add({name: 'Anna', age: 25});
medium
A. Update existing user document named Anna with age 25
B. Add a new user document with name Anna and age 25 to Firestore
C. Delete user document named Anna from Firestore
D. Retrieve all users named Anna from Firestore

Solution

  1. Step 1: Understand Firestore collection and add method

    The add method creates a new document in the 'users' collection with given data.
  2. Step 2: Analyze code effect

    The code adds a new user with name 'Anna' and age 25; it does not update, delete, or retrieve.
  3. Final Answer:

    Add a new user document with name Anna and age 25 to Firestore -> Option B
  4. Quick Check:

    add() creates new document = Add a new user document with name Anna and age 25 to Firestore [OK]
Hint: add() means create new document in Firestore [OK]
Common Mistakes:
  • Thinking add updates existing data
  • Confusing add with get or delete
  • Assuming it retrieves data
4. You tried to deploy your Firebase Hosting but got an error saying "No public directory found." What is the most likely cause?
medium
A. You did not install Firebase CLI
B. You did not create a Firestore database
C. Your internet connection is down
D. You forgot to specify the public directory during firebase init hosting

Solution

  1. Step 1: Understand the error message context

    The error "No public directory found" means Firebase cannot find the folder with website files to deploy.
  2. Step 2: Identify cause related to initialization

    This usually happens if you did not set or create the public directory path during firebase init hosting.
  3. Final Answer:

    You forgot to specify the public directory during firebase init hosting -> Option D
  4. Quick Check:

    Missing public directory = You forgot to specify the public directory during firebase init hosting [OK]
Hint: Set public directory when initializing Hosting [OK]
Common Mistakes:
  • Blaming internet connection
  • Confusing Firestore with Hosting
  • Not installing Firebase CLI
5. You want to track how users interact with your app and also store user profiles. Which two Firebase services should you combine?
hard
A. Firestore and Analytics
B. Hosting and Cloud Functions
C. Authentication and Hosting
D. Realtime Database and Storage

Solution

  1. Step 1: Identify service for storing user profiles

    Firestore is a database service suitable for storing structured user profile data.
  2. Step 2: Identify service for tracking user interactions

    Analytics tracks user behavior and app usage statistics.
  3. Final Answer:

    Firestore and Analytics -> Option A
  4. Quick Check:

    Store profiles + track usage = Firestore + Analytics [OK]
Hint: Store data with Firestore, track with Analytics [OK]
Common Mistakes:
  • Choosing Hosting for data storage
  • Confusing Realtime Database with Analytics
  • Mixing Storage with tracking
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard