Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a root node in a Firebase JSON tree.
Firebase
{
"root": [1]
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an empty string as the root value
Using invalid JSON syntax like missing quotes
✗ Incorrect
The root node must have a valid string value. "rootValue" is a clear root node value.
2fill in blank
mediumComplete the code to add a child node named 'users' under the root.
Firebase
{
"root": {
[1]: {}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different child node name
Missing quotes around the key
✗ Incorrect
The child node should be named 'users' as specified.
3fill in blank
hardFix the error in the JSON tree by completing the missing key for a user ID.
Firebase
{
"root": {
"users": {
[1]: {
"name": "Alice"
}
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted keys which is invalid JSON
Using wrong key names like 'name' or 'id' instead of user ID
✗ Incorrect
User IDs must be strings in quotes. "user1" is the correct key format.
4fill in blank
hardFill both blanks to add two users with their names under 'users'.
Firebase
{
"root": {
"users": {
[1]: {"name": "Bob"},
[2]: {"name": "Carol"}
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using duplicate keys
Using keys without quotes
✗ Incorrect
Use unique user IDs as keys for each user node.
5fill in blank
hardFill all three blanks to add a nested address object for user1.
Firebase
{
"root": {
"users": {
"user1": {
"name": "Dave",
"address": {
"street": [1],
"city": [2],
"zip": [3]
}
}
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing quotes around string values
Using numeric values without quotes for zip
✗ Incorrect
Address fields must be strings representing street, city, and zip code.