Section A. Terminology and Short answer
Attempt all questions in this section. The value of each question is as shown. Answer these questions in the answer booklet that is provided.
Question 1.
Define each of the following terms. Each is worth 2 marks
1. Gossip Protocol
2. Graph Traveral
3. Bipartite graphs
4. Scaling out
5. Denormalisation
Question 2.
Explain 3 ways you could model the following product hierarchy in a document database.
Question 3.
What is a mutable document? Give an example and discuss the issue that mutable documents can have on performance.
Question 4.
How are Column Family databases similar to Document databases? Discuss why multirow transactions should be avoided in Column Family databases?
Question 5.
Name and explain the concepts of CAP theorem.
Section B on next page
Section B. NoSQL coding (Total 30 Marks)
Attempt all questions in this section. The value of each question is as shown. Answer these questions in the answer booklet that is provided.
Question 6.
Using the sample document below explain what each of the following MongoDB queries is doing.
{ "fname" : "Rachel", "lname" : "Cunningham",
"display" : "Rachel Cunningham", "type" : "student",
"age" : 24,
"checkouts" : [
{ "id" : "95000",
"year" : "2018",
"month" : "1",
"day" : "25",
"book" : 5237,
"title" : "Mastering the database environment", "pubyear" : "2015",
"subject" : "database"
},
{ "id" : "95001",
"year" : "2018",
"month" : "1",
"day" : "25",
"book" : "5240",
"title" : "iOS Programming", "pubyear" : "2015", "subject" : "Programming"
} ]
}
a) db.patron.find({"checkouts.subject":"cloud"}, {display:1, age:1}).pretty()
b) db.patron.find({type: "faculty", "checkouts.subject":"programming"}, {fname:1, lname:1, type:1, _id:0})
c) db.patron.find({type:"student", $and: [{age: {$gte:22}}, {age: {$lte:26}}]},
{fname:1, lname:1, age:1, _id:0})
d) db.patron.find({$or: [{type: "faculty", "checkouts.book":"5235"},
{type: "student", "checkouts.book":5240, age: {$lt:30}}
] } ).pretty()
Question 7.
Looking at the Neo4j CQL code below, draw the final graph with all labels and properties.
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964}) CREATE (Carrie:Person {name:'Carrie-Anne Moss', born:1967}) CREATE (LillyW:Person {name:'Lilly Wachowski', born:1967}) CREATE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix) CREATE (Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrix) CREATE (LillyW)-[:DIRECTED]->(TheMatrix)