Database miscellaneous


Database miscellaneous

  1. Let E1 and E2 be two entities in an E/R diagram with simple single valued attributes. R1 and R2 are two relationship between E1 and E2, where R1 is one-to-many and R2 is manyto-many. R1 and R2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in the relational model?









  1. View Hint View Answer Discuss in Forum


    Since R2 is many to many so E1 has some primary key so one tables for E1 & to represent many to many relationship 1 table for R2 which will have the common attribute of E2.R1 & E2 can be merged. So total 3 tables are required. Hence (b) is correct option

    Correct Option: B


    Since R2 is many to many so E1 has some primary key so one tables for E1 & to represent many to many relationship 1 table for R2 which will have the common attribute of E2.R1 & E2 can be merged. So total 3 tables are required. Hence (b) is correct option


  1. It is desired to design an object-oriented employee record system for a company. Each employee has a name, unique Id and salary. Employees belong to different categories and their salary is determined by their category. The functions get Name, geld and compute salary are required. Given the class hierarchy below, possible locations for these functions are
    1. getId is implemented in the superclass
    2. getId is implemented in the subclass
    3. getName is an abstract function in the superclass
    4. getName is implemented in the superclass
    5. getName is implemented in the subclass
    6. getSalary is an abstract function in the superclass
    7. getSalary is implemented in the superclas
    8. getSalary is implemented in the subclass

    Choose the best design.









  1. View Hint View Answer Discuss in Forum

    ID is unique so can be implemented in the superclass.

    Name is a function of superclass.
    Also, Name can be common/duplicate, so must be implemented in superclass.
    Salary is a function of superclass. Also, salary is dependent on the category and hence is implemented in the subclass.

    Correct Option: A

    ID is unique so can be implemented in the superclass.

    Name is a function of superclass.
    Also, Name can be common/duplicate, so must be implemented in superclass.
    Salary is a function of superclass. Also, salary is dependent on the category and hence is implemented in the subclass.



Direction: Consider the following ER diagram :

  1. Which of the following is a correct attribute set for one of the tables for the correct answer to the above question?









  1. View Hint View Answer Discuss in Forum

    Two tables in the scenario will be M1 ,M2 ,M3 ,P1 which is for relation R1 &N1 ,N2 ,P1 ,P2 with P1 as primary key N1 is a weak entity set. This is for relation R2.

    Correct Option: A

    Two tables in the scenario will be M1 ,M2 ,M3 ,P1 which is for relation R1 &N1 ,N2 ,P1 ,P2 with P1 as primary key N1 is a weak entity set. This is for relation R2.


  1. The minimum number of tables needed to represent M, N, P, R1, R2 is









  1. View Hint View Answer Discuss in Forum

    There are 3 entity set, but 2 relations R1 & R2 only. R1 is one to many from P to M. R2 is one to many from P to N. N is weak entity set here.

    Correct Option: B

    There are 3 entity set, but 2 relations R1 & R2 only. R1 is one to many from P to M. R2 is one to many from P to N. N is weak entity set here.



  1. Given the basic ER and relational models, which of the following is incorrect?









  1. View Hint View Answer Discuss in Forum

    An attribute of an entity can have more than one value or multivalue.
    For example,

    Hence, option (a) is correct. Attributes can be composite also, Hence, option (b) is also correct. In the relational table, any attribute can contain only one value which can be null. Hence, option (d) is also correct but by the definition of 1 NF, any attribute in the relational table can contain only one value not more than one values. Hence option (c) is false or incorrect.

    Correct Option: C

    An attribute of an entity can have more than one value or multivalue.
    For example,

    Hence, option (a) is correct. Attributes can be composite also, Hence, option (b) is also correct. In the relational table, any attribute can contain only one value which can be null. Hence, option (d) is also correct but by the definition of 1 NF, any attribute in the relational table can contain only one value not more than one values. Hence option (c) is false or incorrect.