HQ_2_1
The figure shows an instance of a given relation R. Which of the given schemas is valid for this
instance of R?
A. Game ( name, publisher, releaseDate, developer, platform, rating, genre )
B. Game ( name, publisher, releaseDate, platform )
C. Game ( name, publisher, releaseDate, platform, )
D. Game ( name, publisher, releaseDate, )
E. Game ( name, publisher, releaseDate, developer, platform, rating, genre )
F. Game ( name, publisher, releaseDate, developer, platform, rating, genre )
HQ_2_2
You need to store the following information in a object relational database: In an Author
relation, you need to store his unique ID, name, books that he has written, and publishers he
has worked with. The publishers in Author is a nested relation with country and publisher as its
attributes. Each row in this nested relation corresponds to the unique publisher for the author’s
book in that country. The publisher attribute has a type that references a row in the Publisher
relation and the attribute books has a type that is a set of references to rows in the Book
relation. The Publisher relation stores a unique pID and a name (not necessarily unique) for
each publisher. The Book relation stores the unique ISBN for the book, name, year published
and publisher. Note that an ISBN is associated with only one publisher. Select the object
relational schema corresponding to the above description.
A.
Author ( ID, name, books({*Book}), publisher(country, publisher(*Publisher).Publisher) ),
Publisher( pID, name), Book( ISBN, name, yearPublished, publisher(*Publisher).Publisher )
B.
Author ( ID, name, books(*Book), publisher(country, publisher(*Publisher).Publisher) ),
Publisher( pID, name), Book( ISBN, name, yearPublished, publisher(*Publisher).Publisher)
C.
Author ( ID, name, books({*Book}), publisher(country, publisher(*Publisher).Publisher) ),
Publisher ( pID, name), Book ( ISBN, name, yearPublished, publisher({*Publisher}) )
D.
Author ( ID, name, books({*Book}), publisher(country, publisher({*Publisher})) ), Publisher ( pID,
name), Book ( ISBN, name, yearPublished, publisher({*Publisher}) )
E.
Author ( ID, name, books, country, publisher), Publisher( pID, name), Book( ISBN, name,
yearPublished, publisher)
HQ_2_3
Since a relation is a set of tuples, how these tuples are ordered does not matter. Furthermore,
the attributes can be reordered without causing any loss of information. An instance of a relation
is equivalent to another instance if it contains the permuted rows and/or columns of the other.
How many equivalent representations are there for the relation in the given figure?
A. 16! 7!
B. 16!
C. 17!
D. 17!8!
E. 2
HQ_2_4
Select the relational database schema corresponding to the ER design in the figure. If possible,
combine the relation corresponding to the relationship with the relation of one of the entities.
A. E1 ( A1, A2, A3, A4 ) , E2 ( A5, A
6, A7, A8) , E3 ( A9, A10, A11, A12 ) , R ( A1, A2, A3, A5,
A6, A9, A10 )
B. E1 ( A1, A2, A3, A4 ) , E2 ( A1, A2, A3, A5, A6, A7, A8, A9, A10, A13 ) , E3 ( A9, A10, A11,
A12 )
C. E1 ( A1, A2, A3, A4 ) , E2 ( A5, A6, A7, A8, A13 ) , E3 ( A
9, A10, A11, A12 )
D. E1 ( A1, A2, A3, A4 ) , E2 ( A5, A6, A7, A8 ) , E3 ( A1, A2, A3, A5, A6, A9, A10, A11, A12,
A13 )
HQ_2_5
Select the relational database schema corresponding to the ER design in the figure. If possible,
combine the relation for the relationship with the relation of one of the entities.
A. E1 ( A1, A2, A3 ), E2 ( A4, A5, A6 )
B. E1 ( A1, A2, A3, role1_A4, role2_A4, A7 ), E2 ( A4, A5, A6 )
C. E1 ( A1, A2, A3 ), E2 ( A4, A5, A6 ), R ( A1, A2, A4, A7 )
D. E1 ( A1, A2, A3, A4, A7 ), E2 ( A4, A5, A6 )
HQ_2_6
Select the relational database schema corresponding to the ER design in the figure using the
ER approach. Note that an employee must either be a permanent staff or a temp and cannot
be both. That is, the subclasses Permanent and Temp are disjoint.
Simplify the database schema by merging appropriate relations if it will not result in any loss of
information.
A. Employee ( sID, name, salary, accessRights ), Permanent ( sID, insurance, stock ), Temp (
sID, contractPeriod )
B. Employee ( sID, name, salary, accessRights ), Permanent ( sID, insurance, stock ), Temp (
sID, contractPeriod )
C. PermanentEmployee ( sID, name, salary, accessRights, insurance, stock ), TempEmployee (
sID, name, salary, accessRights, contractPeriod )
D. Employee ( sID, name, salary, accessRights ), Permanent ( sID, insurance, stock ), Temp (
sID, contractPeriod ), IsPermanentEmployee( sID, insurance, stock ), isTempEmployee ( sID,
contractPeriod )
HQ_2_7
Select the relational database schema corresponding to the ER design in the figure using the
object-oriented approach.
It is possible for an entity to belong to multiple subclasses. In this case, someone who is both
a permanent and temp employee is a “probationary employee”. Probationary employees
are hired as a permanent staff but has a probation period (contractPeriod from the temp
subclass) during which their contracts can be terminated for poor performance or if they are
ill-suited for the job. Note that an employee must belong to exactly one of the three categories:
permanent employee, temp employee, or a “probationary employee”.
Simplify the database schema by merging appropriate relations if it will not result in any loss of
information.
A. PermanentEmployee ( sID, name, salary, accessRights, insurance, stock ), TempEmployee (
sID, name, salary, accessRights, contractPeriod ), ProbationaryEmployee ( sID, name, salary,
accessRights, insurance, stock, contractPeriod )
B. PermanentEmployee ( sID, name, salary, accessRights, insurance, stock ), TempEmployee (
sID, name, salary, accessRights, contractPeriod )
C. Employee ( sID, name, salary, accessRights ), PermanentEmployee ( sID, name, salary,
accessRights, insurance, stock ), TempEmployee ( sID, name, salary, accessRights,
contractPeriod )
D. Employee ( sID, name, salary, accessRights ), Permanent ( sID, insurance, stock ), Temp (
sID, contractPeriod )
E. Employee ( sID, name, salary, accessRights ), Permanent ( sID, insurance, stock ), Temp (
sID, contractPeriod ), IsPermanentEmployee( sID, insurance, stock ), isTempEmployee ( sID,
contractPeriod )
F. Employee ( sID, name, salary, accessRights ), Permanent ( sID, insurance, stock ), Temp (
sID, contractPeriod )
G. Employee ( sID, name, salary, accessRights ), Permanent ( sID, insurance, stock ), Temp (
sID, contractPeriod ), ProbationaryEmployee ( sID, name, salary, accessRights, insurance,
stock, contractPeriod )
H. Employee ( sID, name, salary, accessRights ), PermanentEmployee ( sID, name, salary,
accessRights, insurance, stock ), TempEmployee ( sID, name, salary, accessRights,
contractPeriod )
HQ_2_8
Which of the following is NOT valid JSON data?
A. { “UserID” : 1235455, “Friends”: [], “Name”: “John Doe”, “Devices” : [“iPhone”, “iPad”,
“Windows 8”] }
B. { “UserID” : 1235455, “Friends”: [34135, 13556, 20344], “Name”: “John Doe”, “Devices” :
[“iPhone”, “iPad”, “Windows”], “Albums” : {“CameraRoll” : [“378721.jpg”, “243535.jpg”], “Family” :
[] } }
C. []
D. [ {} ]
E. [“John Doe”]
F. { “Title” : “Fifa 2017”, “Platform” : { “PlayStation”, “Windows”, “Mac OS X 10.12” }, “Genre” :
“Sports” }
G. {}
H. {“Accounts” : 12356 }
I. [false]
HQ_2_9
Convert the model specified by the UML diagram to a relation schema. Combine appropriate
relations for the relationships if it does not result in any loss of information or introduce any
redundancy.
A. Book ( ISBN, name, publisher, ISBNofOriginal ), Writer ( ID, name ), WrittenBy ( ISBN, ID)
B. Book ( ISBN, name, publisher ), Writer ( ID, name ), Sequels ( ISBNofOriginal, ISBNofSequel
), WrittenBy ( ISBN,ID )
C. Book ( ISBN, ISBNofSequel, name, publisher ), Writer ( ID, name ), WrittenBy ( ISBN, ID, )
D. Book ( ISBN, ISBNofSequel, name, publisher ), Writer ( ID, ISBNofBook, name )
E. Book ( ISBN, name, publisher ), Writer ( ID, ISBNofBook, name ), Sequels ( ISBNofOriginal,
ISBNofSequel )
F. Book ( ISBN, name, publisher ), Writer ( ID, name )
HQ_2_10
Scenario 1:
You need to store a large collection of images. Each image has tags indicating the objects in
that image. The most common query is to retrieve all images associated with a given set of
labels.
Scenario 2:
You run an online discussion forum BufferOverflow for programmers. Your system needs to
keep track of registered users and allow them to post questions, answers and comments. The
posts can be tagged with topics. Some common queries are: retrieve all posts containing a set
of keywords, retrieve posts related to a given set of topics within a time period, and retrieve all
posts written by a particular user.
Scenario 3:
You are tasked with building the backend of a social network. This requires you to construct a
knowledge base, which is essentially a collection of interconnected data. The system must be
able to discover products that are similar to those “liked” by a user or people close to her (i.e.,
her family, friends, or friends of friends etc.) so that the system can display relevant
advertisements to the user.
Which type of database, relational, key-value, or graph, is the most appropriate for scenarios 1,
2 and 3?
A. 1: Relational, 2: Key-value, 3: Graph
B. 1: Key-value, 2: Key-value, 3: Graph
C. 1: Key-value, 2: Relational, 3: Graph
D. 1: Relational, 2: Key-value, 3: Key-value
E. 1: Relational, 2: Graph, 3: Key-value
F. 1: Graph, 2: Key-value, 3: relational
Purchase answer to see full
attachment