0
0
Firebasecloud~20 mins

Modular SDK (v9+) tree-shaking in Firebase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Firebase Modular SDK Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why does Modular SDK (v9+) improve tree-shaking?

In Firebase Modular SDK (v9+), why is tree-shaking more effective compared to previous versions?

ABecause it disables code splitting to optimize loading.
BBecause it uses named imports allowing bundlers to remove unused code.
CBecause it requires importing the entire Firebase namespace.
DBecause it bundles all Firebase services into one large file.
Attempts:
2 left
💡 Hint

Think about how importing only what you need affects the final bundle size.

Configuration
intermediate
2:00remaining
Identify the correct import for Firestore with Modular SDK

Which import statement correctly imports Firestore functions for tree-shaking in Firebase Modular SDK (v9+)?

Aimport { getFirestore } from 'firebase/firestore';
Bimport firebase from 'firebase'; const db = firebase.firestore();
Cimport { firestore } from 'firebase/app';
Dimport * as firestore from 'firebase/firestore';
Attempts:
2 left
💡 Hint

Look for the import that uses named imports from the specific service path.

Architecture
advanced
2:00remaining
Effect of importing entire Firebase namespace on bundle size

What happens to your app's bundle size if you import the entire Firebase namespace instead of using Modular SDK imports?

ABundle size increases significantly because all Firebase code is included.
BBundle size stays the same regardless of import style.
CBundle size decreases because tree-shaking removes unused code.
DBundle size is smaller because the namespace is cached.
Attempts:
2 left
💡 Hint

Consider what happens when you import everything even if you use only a small part.

service_behavior
advanced
2:00remaining
Tree-shaking impact on unused Firebase services

If you only import Authentication and Firestore from Firebase Modular SDK (v9+), what happens to the code for other Firebase services like Storage?

ACode for Storage causes runtime errors if not imported explicitly.
BCode for Storage is included anyway because Firebase bundles all services.
CCode for Storage is excluded from the final bundle due to tree-shaking.
DCode for Storage is loaded lazily only when needed.
Attempts:
2 left
💡 Hint

Think about how tree-shaking removes unused code from the bundle.

security
expert
3:00remaining
Security risk of importing entire Firebase SDK in production

What is a potential security risk of importing the entire Firebase SDK instead of using Modular SDK imports in a production app?

AThere is no security risk; only performance is affected.
BModular SDK imports disable Firebase security rules by default.
CImporting entire SDK encrypts data improperly causing leaks.
DExposing unused Firebase services increases attack surface and potential vulnerabilities.
Attempts:
2 left
💡 Hint

Think about how unused code can affect app security.