0
0
Intro to Computingfundamentals~10 mins

NoSQL and alternative models in Intro to Computing - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all documents from a MongoDB collection named 'users'.

Intro to Computing
db.users.[1]()
Drag options to blanks, or click blank then click option'
Afind
Bselect
Cquery
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using SQL-like commands such as 'select' instead of MongoDB methods.
Trying to use 'get' which is not a MongoDB collection method.
2fill in blank
medium

Complete the code to insert a document with name 'Alice' into the 'users' collection in MongoDB.

Intro to Computing
db.users.[1]({"name": "Alice"})
Drag options to blanks, or click blank then click option'
Aadd
BinsertOne
Cput
Dsave
Attempts:
3 left
💡 Hint
Common Mistakes
Using SQL commands like 'add' or 'save' which do not exist in MongoDB.
Confusing with bulk insert methods like 'insertMany'.
3fill in blank
hard

Fix the error in the MongoDB query to find users older than 25.

Intro to Computing
db.users.find({"age": {"[1]": 25}})
Drag options to blanks, or click blank then click option'
A=
B>
C$gt
D=>
Attempts:
3 left
💡 Hint
Common Mistakes
Using plain '>' which is invalid in MongoDB queries.
Using '=' which means exact match, not greater than.
4fill in blank
hard

Fill both blanks to create a key-value pair in a Redis command to set the key 'user:1' with value 'Alice'.

Intro to Computing
SET [1] [2]
Drag options to blanks, or click blank then click option'
Auser:1
BAlice
Cuser1
DBob
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping key and value positions.
Using incorrect key names like 'user1' without colon.
5fill in blank
hard

Fill all three blanks to create a Cassandra CQL query that selects all columns from the 'employees' table where 'department' equals 'sales'.

Intro to Computing
SELECT [1] FROM [2] WHERE [3] = 'sales';
Drag options to blanks, or click blank then click option'
A*
Bemployees
Cdepartment
Demployee
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong table name like 'employee'.
Using wrong column name in WHERE clause.