Menoufia National University Subject: Advanced Database
Faculty of Computers and Artificial Intelligence Year: Third Level – First Term
Mid Term Exam –09 November 2024 Time: 60 minutes
Pages: 3 Pages Mark: 20 points
Part 1 (10 Marks)
Q1] Choose the correct answer (5 Marks):
1. The ………… property of relational database means that effects of commited
transactions are permanent.
a. Durability
b. Isolation
c. Consistency
d. Atomicity
2. MongoDB is an example of …...
a. Key-value stores
b. Document Stores
c. Graph Database
d. Wide Column Stores
3. The...............can be used to split larger MongoDB documents into smaller chunks.
a. DBMS
b. Sector
c. Fat System
d. GridFS
4. The...............operator add one item / all items to the end of an array.
a. $pull
b. $push
c. $pop
d. $addToSet
5. The................operator removes all array items that match a specified query.
a. $pull
b. $push
c. $pop
d. $addToSet
6. The................modifier returns at most a certain number of documents.
a. sort
b. skip
1
c. limit
d. None of the above
7. The ……… operator tests whether a given array contains at least one item that
satisfies all the involved query operations.
a. $all
b. $elemMatch
c. $size
d. $regex
8. The..............means adding resources to a single node in a system.
a. Replication
b. Sharding
c. Horizontal scaling
d. Vertical scaling
9. Which of the following is a false assumption of horizontal scaling?
a. Network is reliable
b. Network is secure
c. Bandwidth is infinite
d. All the above
10. The ……… property means system continues to operate even when two or more
nodes get isolated.
a. Consistency
b. Durability
c. Partition Tolerance
d. Availability
Q2] True/ False (5 Marks):
1. Volume characteristic of big data means that data volume is increasing
linearly.
2. Relational databases follow the current trends of big data.
3. MongoDB document is represented as one JSON object.
4. The MongoDB Field names can start with $.
5. The $slice operator selects the first count items of an array.
6. The scalability means the capability of a system to handle growing amounts of data
and/or queries without losing performance.
7. Sharding partitioning means placement of different data on different node.
2
8. The write-write consistency conflict write and read requests on the same
aggregate are initiated concurrently.
9. In master-slave replication architecture all write requests can only be
handled by the master.
10. In sharding + master-slave replication, the data may be duplicated on
different masters.
Part 2 (10 Marks)
Q1] List at least three sources of Big Data?
Mobile data, real-time data , health-care, e-commerce, web-
content, data comes from sensors, social media and networks,
scientific research
Q2] What are the main drawbacks of vertical scaling?
Proactive provisioning, vendor lock-in, higher costs, deployment down time, single
point of failure, performance limit
Q3] Given the structure of Restaurants collection
Write MongoDB queries that perform the following:
1. Write a MongoDB query to display the fields restaurant_id, name and cuisine for all
the documents in the collection restaurant.
• db. Restaurants.find({}, {restaurant_id: 1, name: 1, cuisine: 1, _id: -1})
2. Write a MongoDB query to update cuisine to “Solid” for restaurant_id 30075445, for
only first matched document.
3
Db.restaurant.updateOne({restaurant_id:
‘30075445’}, {$set: {cuisine: ‘Solid’}})
3. Write a MongoDB query to remove last item in grades array.
Db.restaurant.updateOne({}, {$pop:
{grades: 1}})
4. Write a MongoDB query to delete all documents that have address building 1007.
Db.restaurant.deleteMany({‘address.building’: 1007})
4
5. Write a MongoDB query to sort all documents in restaurants collection in
descending order by name.
• db.restaurant.find({}).sort({name: -1})
6. Write a MongoDB query to find all documents that have names start with string
“Morris”.
Db.resturant.find({name: {$regex: “^Morris.*”}})
Best Wishes
DR. Mohamed Malhat