Self Studies

Databases Test 2

Result Self Studies

Databases Test 2
  • Score

    -

    out of -
  • Rank

    -

    out of -
TIME Taken - -
Self Studies

SHARING IS CARING

If our Website helped you a little, then kindly spread our voice using Social Networks. Spread our word to your readers, friends, teachers, students & all those close ones who deserve to know what you know now.

Self Studies Self Studies
Weekly Quiz Competition
  • Question 1
    1 / -0

    Consider a relation R(ABCDE) and the primary key is A E. In the given relational schema which of the following is not a superkey?

    Solution

    Concept:

    A superkey is a set of attributes within a table whose values can be used to uniquely identify a tuple. A candidate key is a minimal superkey.

    A superkey is a superset of candidate key or primary key.

    Explanation:

    Primary key is AE. (given)

    All superkeys must contain this primary key AE. From the given keys, key, which doesn’t contain

    the AE.

    Here, option 3: DACB

    “DACB” doesn’t contain the primary key AE. So, it is not a superkey.
  • Question 2
    1 / -0

    Consider the relation R(X, Y, Z, W, V) in which X, Y, Z, W, and V are the attributes and the following set of functional dependencies

    A = { {X, Y} → {Z, W},  {X, W, V} → {Q, R}  }

    Which of the following is the trivial functional dependency in A+, where A+ is closure of A?

    Solution

    Concept:

    The closure of F, denoted as F+, is the set of all regular FD, that can be derived from.

    For trivial functional dependency,

    Let A and be two sets consists of attributes of a relation

    A → B

    \(\supseteq\) B 

    Explanation:

    Option 1

    {X, Z} → {Z, W}

    {X, Z}  \(\nsupseteq\) {Z, W}

    Not a trivial functional dependency

    Option 2: 

    {X, V} → {V}

    {X, V} \(\supseteq\) {V}

    It is a trivial functional dependency

    Option 3

    {X, W, V} → {Y}

    {X, W, V} \(\nsupseteq\)  {Y}

    Not a trivial functional dependency

    Option 4

    {Y, W } → {Y, X}

    {Y, W } \(\nsupseteq\) {Y, X}

    Not a trivial functional dependency

    NOTE:

    \(\supseteq\) → superset

    \(\nsupseteq\) → not superset

  • Question 3
    1 / -0

    Let R1(a, b, c) and R2(x, y, z) be two relations in which a is the foreign key of R1 that refers to the primary key of R2. Consider following four options.

    (a) Insert into R1

    (b) Insert into R2

    (c) Delete from R1

    (d) Delete from R2

    Which of the following is correct about the referential integrity constraint with respect to above?

    Solution

    Concept:

    A foreign key in a table refers to the primary key of another table. It contains subset of entries of primary key of other table. It specifies the referential integrity constraint.

    Explanation:

    Given:

    Two relations:

    R1(a, b, c) and  R2(x, y, z)

    a is the foreign key of R1 that refers to the primary key of R2

    (a) Insert into R1

    It will cause violation. As a is the foreign key referring to the primary key of R2. If we insert values in R1, then that value must also be present in the primary key of R2 and which is not necessary as while inserting in R1 we are not aware of R2.

    (b) Insert into R2

    It will not cause violation. Because inserting element in R2 will not effect R1. Values present in R2’s primary key may or may not present in foreign key of R1.

    (c) Delete from R1

    It has no effect on the relation. It will not cause violation. Values that are deleted from R1 need not be deleted from R2. As R1 contains the foreign key.

    (d) Delete from R2

    It will cause violation. If we delete tuples from R2 relation, then if that tuple is present in R which is referring to the primary key of R2 must also be deleted.
  • Question 4
    1 / -0
    Consider the relational schema R(A B C D) with following functional dependency set F = {A → BC, C → D}; The relation R is in _____
    Solution

    Functional Dependencies are: A -> BC and C-> D

    First, find the candidate key for the relation R(A, B, C and D).

    A+ = {A, B, C, D},

    ‘A’ closure is deriving all the attributes of the relation. So, it is candidate key

    A → BC                        

    This functional dependency is in BCNF form as left side is the key

    C → D

    In this functional dependency, left side is not the key so not in BCNF. Also, right side is not prime attribute. So, not in 3NF.

    But it is in 2NF as there is no partial dependency in this.

    So, when one functional dependency comes in weaker form then overall relation will be in that form. Here, given relation is in 2NF.
  • Question 5
    1 / -0

    Suppose T1(P, Q) and T2(R, S) are two relation schemas. Let t1 and t2 be the corresponding relation instances. R is a foreign key that refers to P inT1. If data in t1 and t2 satisfy referential integrity constraints, which of the following is/are always true?

    I. ∏R (t2) – ∏P(t1) = Φ

    II. ∏P(t1) ≠ ∏R(t2)

    III. ∏P (t1) – ∏R (t2) = Φ
    Solution

    Since R of T2 is referring to P of T1

    R (t2) ⊆ ∏P (t1)

    R (t2) – ∏P(t1) = Φ (always holds)

    Hence, I is true

    P(t1) ≠ ∏R(t2)

    It is possible if ∏R(t2) doesn’t contain the same number of elements (less) as  ∏P(t1)

    but it not always true

    P (t2) – ∏R(t1) = Φ

    It is possible if ∏R(t2) contains the same number of elements as ∏P(t1)

    but it not always true

    0nly I always true

    II and III may or may not be true
  • Question 6
    1 / -0

    Consider the relational schema R = (P, Q, R, S, T, U) on which the following functional dependencies hold:

    F = {P ➝ Q, QR ➝ S, T ➝ R, S ➝ P}

    How many candidate keys are present in R?

    Solution

    Concept:

    Candidate key: it is the set of attributes that uniquely identifies a relation. It is also known as superkey with no repeated attributes.

    Explanation:

    Relation R = R = (P, Q, R, S, T, U)

    F = {P ➝ Q, PQ ➝ S, T ➝ R, S ➝ P}

    Find the closure of keys given. If all the attributes of relation are present in the closure, then it will be the candidate key of that relation.

    (PTU)+ = {P, T, U, Q, R, S}

    Therefore, PTU is a key

    (QTU)+ = {Q, T, U, R, S, P}

    Therefore, QTU is a key

    (STU)+ = {S, T, U, R, P, Q}

    Therefore, STU is a key

    Hence there are 3 candidate keys.

  • Question 7
    1 / -0

    Which of the following statements are not correct?

    S1: 3NF decomposition is always Lossless join and dependency preserving.

    S2: 3NF decomposition is always lossless join but may or may not be dependency preserving.

    S3: BCNF decomposition always lossless join and dependency preserving.

    S4: BCNF decomposition is always lossless join but may or may not be dependency preserving
    Solution

    Concept:

    Lossless join: It guarantees that the spurious tuple generation problem does not occur with respect to the relation schemas created after decomposition

    Dependency preservation: It ensures that each functional dependency is represented in some individual relation resulting after decomposition.

    Explanation:

    3NF:

    • Third normal form is based on the concept of transitive dependency. A functional dependency X->Y in a relation schema R is a transitive dependency if there exists a set of attributed Z in R that is neither a candidate key nor a subset of any key of R.
    • A relation is in 3NF if it satisfies 2NF and no prime attribute of R is transitively dependent on the primary key.
    • If X - > A is a functional dependency, then A should be prime attribute or X should be a candidate key.
    • Loss less join and dependency preservation is always possible in 3NF. 3NF decomposition is always lossless join and dependency preserving.

    BCNF:

    • It stands for Boyce codd normal form.
    • A relation R is in BCNF if whenever a non-trivial functional dependency X -> A holds in R, then X is a superkey of R. Any relation with two attributes is always in BCNF. Because when a relation contains only two attributes than one attributes determines another and left side of the functional dependency will always be a candidate key in that case.
    • BCNF is not always dependency preserving.
  • Question 8
    1 / -0

    Consider the schem a a r(A, B, C, D, E) with the following functional dependencies:

    A → BC

    CD → E

    B → D

    E → A

    The decomposition of the schema into r1(A, B, C) and r2(A, D, E) is _________.

    Solution

    To check for lossless join decomposition using FD set, following conditions must hold:

    1. Union of Attributes of R1 and R2 must be equal to attribute of R. Each attribute of R must be either in R1 or in R2.
    i.e.  Att(R1) U Att(R2) = Att(R)
    2. Intersection of Attributes of R1 and R2 must not be NULL.
    i.e. Att(R1) ∩ Att(R2) ≠ Φ
    3. Common attribute must be a key for at least one relation (R1 or R2)
    i.e. Att(R1) ∩ Att(R2) -> Att(R1) or Att(R1) ∩ Att(R2) -> Att(R2)
     

    In the given schema r(A, B, C, D, E), the candidate key is A because A+ = {A, B, C, D, E}

    1. First condition holds true as Att(R1) U Att(R2) = (ABC) U (ADE) = (ABCDE) = Att(R).
    2. Second condition holds true as Att(R1) ∩ Att(R2) = (ABC) ∩ (AD) ≠ Φ
    3. Third condition holds true as Att(R1) ∩ Att(R2) = A is a key of R1(ABC) because A->BC is given.


    Therefore, the relation is lossless.

    For dependency preserving: If we decompose a relation R into relations R1 and R2, all dependencies of R either must be a part of R1 or R2 or must be derivable from combination of FD’s of R1 and R2.

    Therefore, the above decomposition does not preserve dependency.

  • Question 9
    1 / -0

    Which of the following is/are false for the relational table R?

    I. In BCNF, R has a nontrivial functional dependency Y → X, where Y is not a superkey and X is a prime attribute.

    II. In 3NF, R has a nontrivial functional dependency Y → X, where Y is not a superkey and X is a non-prime attribute and Y is a proper subset of some key.

    III. In 2NF, R has a nontrivial functional dependency Y → X, where Y is a superkey.

    Solution

    Statement I: False

    In 3NF, R has a nontrivial functional dependency Y → X, where Y is not a superkey and X is a prime attribute

    Statement II: False

    In 2NF, R has a nontrivial functional dependency Y → X, where Y is not a superkey and X is a non-prime attribute and Y is a proper subset of some key.

    Statement III: True

    In BCNF, R has a nontrivial functional dependency Y → X, where Y is a superkey.

    Therefore it is also in 2NF

Self Studies
User
Question Analysis
  • Correct -

  • Wrong -

  • Skipped -

My Perfomance
  • Score

    -

    out of -
  • Rank

    -

    out of -
Re-Attempt Weekly Quiz Competition
Selfstudy
Selfstudy
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now