From 7f3252f4364943516594a9ea4f931b5936387ec7 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Mon, 18 Jul 2022 12:57:23 +0100 Subject: [PATCH] Adds MCQs. --- database/mcqs/02-integrity-er-diagram.md | 32 ++++++++++++++++++++++++ database/mcqs/03-normalisation-acid.md | 32 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 database/mcqs/02-integrity-er-diagram.md create mode 100644 database/mcqs/03-normalisation-acid.md diff --git a/database/mcqs/02-integrity-er-diagram.md b/database/mcqs/02-integrity-er-diagram.md new file mode 100644 index 0000000..e30f955 --- /dev/null +++ b/database/mcqs/02-integrity-er-diagram.md @@ -0,0 +1,32 @@ +# Questions +1. Joe Bloggs is helping us build Scaler. He is trying to delete some batches but the database throws an error that the batch is used by a tuple in another table. Which type of integrity constraint is being enforced here? + >A. User-defined integrity \ + B. Domain integrity \ + C. Entity integrity \ + D. Referential integrity +--- +2. Which of the following is not an example of domain integrity constraints? + + >A. Validating that input is correct data type \ + B. Ensuring value is not null if a non-nullable column \ + C. Making sure each row is unique \ + D. Checking if the value exceeds maximum length +--- +3. Joe Bloggs is taking some time off to build his house. A house can have many rooms. What is the cardinality of house to room? + >A. One to Many (1:m) \ + B. One to One (1:1) \ + C. Many to Many (m:n) +--- +4. Let us say a house has a house_id and a room has room_id. +Given the cardinality of house to room, which is the ideal place to store their relationship i.e. reference? + >A. room_id in house \ + B. Separate table for room_id and house_id \ + C. Array of room_ids in house \ + D. house_id in room + +--- +# Answers +1. D. `Referential integrity` +2. C `Making sure each row is unique` +3. A `One to Many (1:m)` +4. D `house_id in room` \ No newline at end of file diff --git a/database/mcqs/03-normalisation-acid.md b/database/mcqs/03-normalisation-acid.md new file mode 100644 index 0000000..a3fee79 --- /dev/null +++ b/database/mcqs/03-normalisation-acid.md @@ -0,0 +1,32 @@ +# Questions +1. Joe Bloggs is creating a social media today. However, Joe has kept user and group information in the same table. Now whenever Joe removes a user, the group information is also gone. Which type of anomaly is this? + >A. Insertion \ + B. Updation \ + C. Deletion +--- +2. A user has an ID, name, email and group ID. One user can only have one email and it is unique. +Which of the following dependencies is not correct? + + >A. ID -> NAME \ + B. EMAIL -> NAME \ + C. EMAIL -> GROUP ID \ + D. NAME -> GROUP ID +--- +3. Joe has created a table for group members where the columns are `Group ID, User ID, Rating, Group Name`. The primary key here is `Group ID, User ID`. +Which type of functional dependency exists? + >A. No functional dependency \ + B. Transitive \ + C. Partial +--- +4. Joe has identified that one of his tables does not satisfy 1NF constraints. Which of the following types of ERD attributes are allowed under 1NF? + >A. Composite \ + B. Multivalued \ + C. Derived \ + D. Index + +--- +# Answers +1. A. `Deletion` +2. D `NAME -> GROUP ID` +3. C `Partial` +4. C `Derived` \ No newline at end of file