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. (False)
2. Relational databases follow the current trends of big data. (False)
3. MongoDB document is represented as one JSON object. (True)
4. The MongoDB Field names can start with $. (False)
5. The $slice operator selects the first count items of an array. (True)
6. The scalability means the capability of a system to handle growing amounts of data
and/or queries without losing performance. (True)
7. Sharding partitioning means placement of different data on different node.
(True).
2
8. The write-write consistency conflict write and read requests on the same
aggregate are initiated concurrently. (False)
9. In master-slave replication architecture all write requests can only be
handled by the master. (True)
[Link] sharding + master-slave replication, the data may be duplicated on
different masters. (False)
Part 2 (10 Marks)
Q1] List at least three sources of Big Data?
A1]
• Social media and networks
• Scientific instruments
• Mobile Devices
• Sensor technology and networks
Q2] What are the main drawbacks of vertical scaling?
A2]
1. Performance limits
a. Even the most powerful machine has a limit
b. Moreover, everything works well. at least until we start approaching such
limits
2. Higher costs
a. The cost of expansion increases exponentially
b. In particular, it is higher than the sum of costs of equivalent commodity
hardware
3. Proactive provisioning
a. New projects/applications might evolve rapidly
b. Upfront budget is needed when deploying new machines
c. And so flexibility is seriously suppressed
4. Vendor lock-in
a. There are only a few manufacturers of large machines
3
b. Customer is made dependent on a single vendor. Their products, services, but
also implementation details, proprietary formats, interfaces, support, ...
c. I.e. it is difficult or impossible to switch to another vendor
5. Deployment downtime
a. Inevitable downtime is often required when scaling up
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.
[Link]({}, {"restaurant_id":1, "name":1, "cuisine":1})
2. Write a MongoDB query to update cuisine to “Solid” for restaurant_id 30075445, for
only first matched document.
[Link]({"restaurant_id":"30075445"},
{$set:{"cuisine":"Solid"}})
3. Write a MongoDB query to remove last item in grades array.
[Link]({"restaurant_id":"30075445"},
{$pop:{"grades":-1}})
4. Write a MongoDB query to delete all documents that have address building 1007.
[Link]({"[Link]": "1007"})
4
5. Write a MongoDB query to sort all documents in restaurants collection in
descending order by name.
[Link]().sort({"name":-1})
6. Write a MongoDB query to find all documents that have names start with string
“Morris”.
[Link]({"name":{ $regex:"Morris.*"}})
Best Wishes
DR. Mohamed Malhat