0% found this document useful (0 votes)
13 views

DBMS previous ques

The document contains a series of assignments and questions related to Database Management Systems from Malnad College of Engineering. It includes various questions on relational schemas, keys, and SQL queries, along with their correct answers and explanations. The content is structured as multiple-choice questions (MCQs) with a focus on understanding database concepts and operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views

DBMS previous ques

The document contains a series of assignments and questions related to Database Management Systems from Malnad College of Engineering. It includes various questions on relational schemas, keys, and SQL queries, along with their correct answers and explanations. The content is structured as multiple-choice questions (MCQs) with a focus on understanding database concepts and operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 77
Qstudocu 2 e e = ° Search for courses, books or documents a Discovery ¥ (@ Course: Database Management system (cs20!) Nptelallass 22 - nptel answers assignments documents University: Malnad College of Engineering wie «nos Database Management System: Assignment 1 ‘otal Maks: 20 Jame 7, 2022 Question 1 Question 1 Consider the following table: “Studentroll [name | dept.code | dept_name | project.group ‘Sar Rohit | DOr CSE Tage Processing Csi Sidra | DOS. IT Computer Archivertre Csi Side] Dav 1 Ethioal Hacking CSIs Reeia | Daz ECE Sigual Processing CSIs Resta | DOD ECE Tinage Processing EEIST Rina | DOT EE Trane Processing ent the correct statement(s) Marks? MEQ a) The above table is an example of an instance of relation student. ) The above table is an example of a logical schema of relation studer ©) The above table is an example of a physical schema of relation student. 4) The above table is an example of an abstraction of relation student, Answer: a) Explanation: The above table is an example of inst Hence, option a) is correct. 1s of relation student. ae Question 2 A relation R has 2 candidate keys with 1 and 2 attributes respectively. These are 40 super keys fof R. What is the total nnmber of attributes in R? Marks: 2MCQ a)3 v4 95 ao Answer: a) Explanation: A relation R with n attributes and 2 candidate keys having 1 and 2 attributes respectively, has K = 209 4 900-2) — 90-9) superkeys. Here, 1 = 40 So, n ‘option (dl) is correct: 6. Hence, Question 3 Consider the following instances: oer 2 O] mas] [A] Ane ipe | fips aly] fil y aly] [2ty Which of the following relational operations will produce the following tuple only’? Marks: 2MCQ 8) (ge1Ugea) x (@B2U 982) 1) (gas — gpa) (apa @B1) 6) (@e1 — ga) x (goa - gB1) 4 (gx nga) — (a2 981) Answer: ©) Explanation: (981 — 982) produces <3,y>- (82 — QB1) produces <1,y>. Only a Cartesian product between the two will produce[ 3] ¥] #]¥} Hence, option (c) is correct. Question 4 ‘Consider the following instance of CelestialReport (Celest: Grouplead). Object, Reporty, ReportScore, CaleatialUbject | ReportBy | ReportScore | Grouplead Piute Team § 30 T. kurtz Jupiter Team 5 88 L. Kurtz, Sirius & Teas 1 96 Samuel Rigel Team & 96 Louie ‘Which of the following is a Secondary Key in CelestialReport? Marks: 2MSQ 1) {ReportBy, ReportScore} ) (ReportBy, GroupLead} ©) {GroupLead, Celestialonject}. 4d) {RoportScore, GroupLead}. “Answer: a). d) Explanation: A secondary key is formed when a superkey is minimal, but has not been chosen as a primary key. [ReportBy, ReportScore) ean uniquely identify all tuples, but isnot a primary key (CelestialObject). Also, no proper subset of (ReportBy, ReportScore} can bbe a key. The same logic applies for {ReportScore, GroupLead}. Hence, options (a) and (d) Question 5 Consider the following relational schema for a university: ‘© student (rol1_no, nane, dob) ‘© dept(depttio, dilane, location) * project (proj no, sptNo, roll no, pllane) ‘What is the type of the key(s) that will be used to uniquely identify an entity of the project relation? Mask: 2MCQ 8) Simple key ) Alternate Key «) Composite Key 4) Compound key Answer: d) Explanation: As per the definition of compound key; Refer to the slide 4.13 Question 6 Consider the following relational schema for a university «student (ro12_n0, nane, dob) ‘© dopt(depttio, diane, Location) © project ipro3.no, aeprno, rois.no, pane) |Klentify the correct relational algebraic expression for the following query: Mork: 2MCQ Find the names of students who have selected any projeetofferat by the department “CSE”. 8) Thnane ( (student o< project)» Mgeptto(atiane=" ‘cse" (dept)? ) Thnane(aniane=‘‘cse* (dept project)) ©) Tisane (giana! dept) o (project) 4) Thame (student 6 (gan C88" (project))) (student » project) creates a table with all tuples where ro ne attribute ‘When this table is joined with a table containing the dept_no of “CSE”, tuples with the names ‘of students working in projects offered by "CS! department are only preserved, Finally, the projection operation takes out the names of those students, Hence, option (a) is correct. jscover more from: Database Management ——" Cheatsheet- 2201 systemdesign- a4 14 100% () Document continues below Team 14~ nothing Campus DEMS M4Nosc! > Recruitment ~rew system OPERATING SYSTEH Wentify the correct operation(s) which will produce the following output from the above two relations, ‘BOOK TITLE | AUTHOR_WANE | TOTAL_SOLD_COPTES ‘COMPUTER NETWORKS | FOROUZAN T5000 ‘ONPILER ‘ULLMAN 72000 DBS ORTH 15000 MACHINE LEARNING | MITCHELL 16000 NLP ARTIC 72000 ‘OPERATING SYSTEN | GALVIN 725000, a) Ry Re b) Re-R ©) (BUR) 9(RL Re) 4) (B ~Ra)U(Re—&) Answer: d) Explanation: The relation Ry — Ry ix as follows Fi ‘BOOK TEFLE | AUTHOR NANE | TOTAL SOLD_COPTES ‘CORPUTER NETWORKS | FOROUZAN 5000 aN ORTH 8000 MACHINE LEARITNG [MITCHELL 18000 ‘The relation Ry ~ Ry is as follows: Re ‘BOOK TITLE [AUTHOR WANE | TOTAL_SOLD COPIES CONPILER ULLMAN 72000 LP aT 12000 OPERATING SYETEH | — GALVIN 25000, ‘Marks: 2MCQ By union of two above relations, the output is produced. Hence, option d) is correct Question 8 ‘Consider the following instance: ee BOOKID | YEARPUB | BOOKTITLE | AUTHOR NAME | TOTAL.SOLD.COPTES Toor | 2010 TERS ORTH T5000 1002 | 2010 | OPERATING SYSTEN | GALVIN 25000, ¥003_| 2020 ‘CONPILER ULLMAN 72000 7004 | 1995 [DATA STRUCTURES | —CORREH "20000 i008 | 1995 [DATA STRUCTURES | ULLMAN 20000 006 | 1990 | COMPUTER NETWORKS | —FORDUZANT 75000 3007 | 2010 | MACHENE LEARNING | MITCHELL 18000 enti the eorreet operation(s) whieh produces the following output from the above relation Marks: 2 MCQ TookDetaile BOOK ID | VEKRPUE | BOOKTITLE | AUTHOR NANE | TOTAL SOLD.COPIES 002 | 2010 | OPERATING SYSTEM | GALVIN 25000 007 | 2010 | MACHINE LEARNING | —ETCHELT T8000 @) Ticygan_pupe2010) v (TOTAL. SOLD.COPTES> 16000) (BookDetails) >) TeygaR PuB=2010) « (TOTAL SOLD.COPTES>15090) (BookDetaits) ©) cveAR puB=2010) v (TOTAL, SOLD COPIES>15000) (PookDetaits) ©) > (YEAR PUB=2010) » (TOTAL. SOLD.COPTES>15000) (BookDetails) Answer: d) Explanation: In projection operation, a condition cannot be given. So, options (a) and (b) fre not correct I CYEAR.PUB=2010) condition is sed, we get ttee tps as given low. BookDetaile BOO.ID [YEAR PUR | BOOKTITLE | AUTWOR_RANE.| TOTAL SOLD COPIES i001 | 2010 Dans ORTH 15000 1002_| 2010 | OPERATING SYSTEN | — GALVIN 25000 1007 | 2010 | MACHINE EARN | —AITORELT 72000 ISou se another condition CTOTAL SOLD. COPTES > 5000). Te tpn bacomes the sane as the given ontpt Hence, option (a) is correct 9 Question 9 Consider the following instance Boouberaite BOOK.ID [YEAR PUB | BOOKTITLE | AVTHOR-WANE | TOTAL. SOLD COPTES TO _|_ 2010 TBS FORTH 15000 7002 | 2010 | OPERATING SysTEN | — GALVIN 25000 7003 COMPILER ULHRA 1200 100d [1995 | DATA STRUCTURES | — CORNET 20000 7005 | 1996 | DATA STRUCTURES | — ULE 20000 1008 1990 ‘CONPUTER WETWORKS | —FOROUZAW 75000 1007 2010 MACHINE LEARNING | MITCHELL 7000 Mentify the correct output(s) whieh will be produced by the following relational expres Tigook_trTLe(* TOTAL. SOLD.COPIES>18000(BookDetails)) ‘BOOK TELE OPERATING SYSTEX DATA ‘STRUCTURES DATA ‘STRUCTURES ‘BOOK TILE >) [OPERATING SYSTEN DATA ‘STRUCTURES Marks: 2MCQ 00K ID ‘YEAR PUB | BOOK TITLE | AUTHOR_WANE ‘TOTAL SOLD.COPTES | 002 ° 2010 ‘OPERATING SYSTEN | CALVIW 25000, 008 1995 ‘DATA STRUCTURES | CORMEW 20000 005 1995 ‘DATA STRUCTURES [ULLMAN 20000 BOOK TD | VEARLPUR [BOOK TITLE | ATTHOR WANE ‘TOTAL SOLD.COPTES | «) [4002 [2010 | OPERATING SYSTEN| GALVIN 25000, 004 | 1995 | DATA STRUCTURES | CORNEN 20000 Answer: b) Explanation: The condition TOTAL SOLD.COPTES>18000 selects the following tuples. ‘BookDetaile BOOK TD [VEAR-PUE | SOOK TITLE | AUTHOR WANE [ TOTAL SOLD.COPTES 7002 | 2010 | OPERATING SYSTEN| GALVIN 25000, 00| 1995 | DATA STRUCTURES | CORMEN 20000 7008 | 1995 | DATA STRUCTURES | ULLMAN 20000, fe projection operation selecies ony one column and removes duplicate tuples from the ‘output. Hence, option (b) is correct 10 Marks: 2 MSQ Question 10 Which of the following ean be a candidate key for the following instance? BookDetails BOOKID | VERR-PUS [BOOK TILE | AUTHOR.WANE | TOTAL_SOLD.COPTES yoo1_[ 2010 ERS ORTH 75000 i002 [2010 | OPERATING SYSTEN | —GALVTW 25000 00a [2020 ‘CONPTEER TELM 72000 004 [1995 | DATA STRUCTURES | — COANE 20000 1005 [1895 | DATA_STRUCTURES | —ULLHA 7200007 7006 [1990 | COMPUTER WETWORKS | FOROUZANT 76000 i007 [2010 | MACHENE TEARITG | ~ MITCHELL 78000 a) {BO0K.1D, YEAR PUB} ) (B00K 10, BOOK TITLE} ©) {BOOK TITLE, AUTHOR NAME} 4) {B00K 19) Answer: ©), d) Explanation: Option a) is incorrect because {800K 1D, YEAR PUB} forms a superkey Similarly, option b) is incorrect Decause (BOOK 1D, BOOK TITLE} forms a superkey. In the above instance, each row can be uniquely identified by either {BOOK TITLE, AUTHOR NAME) ‘or (BOOK ID} from the given options. Hence, options e) and d) are correct. n Database Management System: Assignment 2 ‘Total Marks: 20 June 17, 2022 Question 1 Consider the following instance: Bak are ttle mathor oo horror} The haunting | Steve K | forest horror coredy | Echoing Laughters | Charlee ¢| friends conedy comedy Happiene carl paredy cookbook, Ju Cookbook ul The Cau s Recipes s Recipes Julien 8 | Treasure Mystery Consider the query SELECT title, author FROM books WHERE theme LIKE "/y" AND genre NOT LIKE "fr" ORDER BY theme DESC Which tite will be present in the first (topmost) tuple of the output produced by the above auery? Marks: 2 MCQ 2) The Cause ») Happens ©) Behoing Laughters @) The haunting Answer: b) Explanation: The clause ORDER BY theme DESC sorts the tuples in descending alphabetical order of theme. Hence, the theme parody will come before friends comedy. ‘The clause SELECT title, author FROM books WHERE theme LIKE "Ay" AND genre NOT LIKE "fe" projects the tuples Happiene Carl>, . Based on the sorted order, Happiena associated with the theme parody will appenr first among, the two tuples. Hence, option (b) is correct 1 Question 2 Consider the following instance: oo genre tle author These horror | The Bauntiag | Steve K | forest horror conedy | Echoing Laughters | Charles G| friends comedy conedy Happiens Cart parody Lifestyle | CockBook Julien § Recipes Lifestyle | CookBook Julien § Recipes tariller | The Cause | Jutien 5 | Treasure Mystery Consider the following queries: CREATE VIEW THENEVIEW AS SELECT thene FROM books WHERE author LIKE "2, 2"; SELECT COUNT(+) FROM THEMEVIEW; ‘What is the ual output after the two queries are executed? Marks: 2MICQ a3 wa os as Answer: ©) "HF selects all themes associnted with an author's name where there is a space. SELECT COUNT(+) FROM THEMEVIEW produces 5 as output, as all the tuples (even those with nondlistinet values) are counted. Hence, option (e) is correct, 2 Question 3 nsider the following instance: ‘scoreboard ‘FameID | Teasliane | Score | Day T | RacerLeague | 87 | 2 1 Heroz wld 2 Heroz | 42 | 2 2 | tegendar | 72 | 2 3 | Legendat_| oo | i Which is the correct option to change the value of gameID from 3 to 2? Marks: 2 MCQ ) UPDATE scoreboard SET ganeID~2 WHERE ganoID-3 ») ALTER TABLE scoreboard SET ganeID=2 WHERE ganeID=3 ©) ALTER scoreboard SET ganeTD=2 WHERE ganeID-3 4) UPDATE TABLE scoreboard SET gameTD=2 WHERE ganeID=3 Answer: a) Explanation: According to the syntax of SQL queries, option (a) is eorsect Question 4 Consider the following instance: scoreboard ganeID | Teanliane | Score | Day T 1 2 2 1 T | RacerLeague | 87 Herez 2 Heroz | 42 Logenta1 | 72 Legenda1_ | 90 The query “SELECT X, AVG(Score) FROM scoreboard GROUP BY X" produces the following tuples as output ips 2| 57 Which attributes) is (ave) represented by Xin the above query? Marks: 2 MCQ a) gamed ») gameID, Day ©) Day @) Day, Score Answer: ¢) Explanation: ‘The Day-wise average of Scores prochices 62.0n Day 1 and 7 on Day 2. Hence, option (c) Is correct Question 5 Consider the following two tables: Frome Tapper Sup] sup.name —[sup-etty) | PC | pname =H TS] Ont All —} Boston GY Chee ® 15 | Jock a Lea | London seit 5 16 | tw Foods | Deli 3 stignty Manca | 16 17 | Foodies London 5 | dalfa Cakes 8 19 _|sipncBite. [Now Yoo| | 7) SttmShake | 17 8 Marie Bieuie | 20 An operation on these two tables generates the following output. Identify the correct operation, Marks: 2MCQ ‘output sup id] sup name | sup city | pid) p name Is Order AU | Boston 5 | Jalla Cakes 15 | Jack Hill Ltd | London 6 | Choez-tt 15. | Jack Him Lut | London 2 | BN Bisenit 16 | Akas Foods | Delhi 3 | Mighty Mune 17 | Foodies. London 7 | Salt n shake 19 | sipn-Bite. | New York 8) Supplier WATURAL LEFT OUTER JOIN Product ) Supplier INVER JOrW Product ©) Supplier NATURAL RIGHT OUTER JOIN Product 4) Supplier NATURAL FULL OUTER JOIN Product In this question the left relation is Supplier and the right relation is Product. ‘The operation eannot be Natural JOIN or RIGHT OUTER JOIN as the last tuple of Supplier (lor which the value of the common atteibute of the Supplier does not match with auy’ value of Product is present in the output When a NATURAL LEFT OUTER JOIN is applied, firstly the tuples are selected from both, right relations which have the same sup.id. Hence, we get 1 record each of eup.id 16, 17, 18 ane 2 records for sup-id = 15, Seconully, the remaining tuples from the left relation which did not have same sup-ia with the right relation are also added to the resulting relation output as shown in the Inst row of output. Hence, option (a) is correct. Question 6 Consider the following schema: player(p_id, tournament code, month, match count) In the player schema, p-id uniquely identifies every record, Marks:2 MCQ Given that a player cannot play more than 5 matches in a month for a tonmament, ident the correct CHECK constraint for the create query of this table, 8) CONSTRAINT CK.mat count for CHECK (if match count < 6) }) CONSTRAINT CK.nat_count for CHECK (if match.count < 6 is true) 6) CONSTRAINT CK mat count CHECK (3E mateh count < 6) 4) CONSTRAINT CK.nat.count CHECK (aatch.count < 6) Answer: d) Explanation [As per the syntax and semanties of SQL notation, 6 Question 7 Consider the following schema: Football Club(f fcnane, fc addres! Player(p id, name, dob, match count, fc.code) ‘You want to design the Playar table in such a way that if» £¢_code value needs to be deleted from the Football Club table, the corresponding records in the Player table that use this e.code will also be deleted, entify the correct CREATE statement(s) for the Player table from the following, Marks: 2 MCQ 8) CREATE TABLE Player( pid WT, zane VARCHAR(S0) NOT NULL, dob DATE, matchcount INT, fc_code INT, PRIMARY KEY(p_ia), FOREIGN KEY (£¢_code) REFERENCES Football Club(#e_code) (OW DELETE CASCADE) ; ») CREATE TABLE Player pid NT, pane VARCHAR(30) NOT NULL, ob DATE, matehcount INT, fc.code INT, PRIMARY KEY(p_ia) , FOREIGN KEY (f¢_code) REFERENCES Football Club(fe_code)); ©) CREATE TABLE Player( pid INT NOT NULL, rnane VARCHAR(30) , dob DATE, mateh_count IT, FOREIGN KEY (fc code) REFERENCES Football Club(fe_code) (OW DELETE CASCADE) ; dd) CREATE TABLE Player( pid INT, name VARCHAR(S0) NOT NULL, dob DATE, match count INT, fe_code INT, PRIMARY KEY(p_id) , FOREIGN KEY (f¢_code) REFERENCES Football Club(fe_code) ON DELETE SET NULL); Answer: a) Explanation: SQL allows three diferent types of the definitions of the foreign key (© OW DELETE CASCADE: When # referenced parent table row is removed, all the childeen fare removed automatically (© OW DELETE SET NULL: When referenced data in the parent key is deleted, all rows in the ‘child table that depend on those parent key values have their foreign keys set to mull ‘© OW DELETE NO ACTION / ON DELETE RESTRICT / (which is the default) prevents deleting ‘parent when there are childven, Hence, option (a) is correct Question 8 Consider the following instance of the relation BookDetaits. ‘Marks: 2 MSQ BookDataile BOOK TD | VEARPUB | BOOKTITLE | AUTHORLWANE | TOTAL. SOLD.COPTES 7001 _|_2010 ‘DENS ORTH 5000 3002 [2010 | OPERATING SYSTEM | GALVIN 25000 i003 | 2020 ‘COMPILER ‘ULLMAN 72000 1004 | 1996 | DATA STRUCTURES | CORMEW 20000 008 [i996 | DATA STRUCTURES | ULLMAN 20000, OOS | 1990 —| COMPUTER NETWORKS | — FOROUZAN T5000 i007 [2010 | MACHINE LEARNING | MITCHELL 18000 entity the correct statement(s) to get the following ontput: Booketails BOOK TD | YEARPUB | BOOKTITLE | AVTHOR.WANE | TOTAL SOLD.COPTES 700i 2010 DES ‘KORTE 5000 7002 | 2010 | OPERATING SYSTEN | GALVIN 725000, 1003 | 2020 ‘COMPILER ‘ULLMAN 12000 008 [ i998 | DATA STRUCTURES | ULLMAN "20000 007 [2010 | MACHINE LEARNING | —AITCHELL 74000 fa) SELECT + FROM BookDetaile WHERE YEAR_PUB=2010 AND AUTHOR_NAME=‘ULLMAN? ; v) SELECT + FROM BookDetails WHERE YEAR_PUB=2010 OR AUTHOR_NAME=“ULLMAN? ; ©) (SELECT * FROM BookDetaile WHERE YEAR_PUB=2010) INTERSECT (SELECT © FROM BookDetaile WHERE AUTHOR_NAME= ULLMAN?) ; 4) (SBLECT + FROM BookDetails WHERE VEAR_PUB=2010) ‘nron (SELECT + FROK BookDetails WHERE AUTHOR_WAME®"ULLMAN?”) ; Answer: (b). (d) Explanation: Output table containing ty SULEMAL Hence, options b) and d) are correct. les whose YEARPUB is 2010 OR AUTHORNAME is Question 9 Consider the following instance of the relation BookDetai. BookDetaile (BOOK ID, YEAR PUB, BOOK TITLE, AUTHOR NAME, TOTAL SOLD COPIES) Marks: 2MCQ BookDatails BOOKID| VENRPUB | BOOK TETLE | AUTHORNANE | TOTAL SOLD_COPIES 001 [2010 DBRS ORTH 75000 002 [2010 | OPERATING SYSTEM | GALVIN 25000, y004| 1998 | DATA STRUCTURES | —CORMEW 20000, 1008 [1995 | DATA STRUCTURES | ULLMAN 20000 00 [i990 | COMPUTER WeTWORKS | — FOROUZNT 75000 3007 [2010 | MACHINE LEARNING | MITCHELL 72000 entify the correct SQL command to find the BOOK.ID with BOOK TITLE of BookDetails whose AUTHOR NAME is neither ‘ULLMAN’ nor “KORTH' and have TOTAL, SOLD COPIES is atleast S000, a) SELECT BOOK.ID, BOOK TITLE FROM BookDetaile| WHERE AUTHORNAME NOT BETWEEN ‘ULLMAN, ‘KORTH) AND (TOTAL SOLD_COPTES > 18000) ; ) SELECT BOOK_TD, BOOKTITLE FROM BookDetails| WHERE AUTHORWAME NOT IN CULLMAN’, ‘MORTH) AND (TOTAL SOLD_COPIES >= 18000) ; ©) SELECT 500K_1D, BOOK TITLE FROM BookDetails WHERE AUTHORWAME NOT AS CULLMAN’, ‘KORTH?) AND (TOTAL_SOLD_COPIES >= 12000); 4) SELECT BOOK_1D, BOOK TITLE FROM BookDetails| WHERE AUTHOR_NAME NOT IN (‘ULLMAN AND (TOTAL_SOLD_COPIES > 18000) ; “xoRTH) Answer: b) Explanation: BETWEEN operator selects values within a given range. The values ean be text, date, or numbers. IN operator allows you to easly test if the expression n It is used to remove the need of multiple OR conciti Hence, we have used NOT 1H to exclude that matches and have TOTAL SOLD-COPIES atleast 18000 means TOTAL, SOLD.COPIES >= 18000. Hence, option b) is correct and the rest are incorrect iehes any’ value in the list of values. 10 Question 10 Consider the following relation schema: BookDevails(BOOK ID, YEAR PUB, BOOK TITLE, AUTHOR.NAME, TOTAL SOLD_COPTES). Marks: 2 MICQ [Hlentify the correct statement to create an INDEX on B00K ID and BODK TITLE of BookDetail= relation named as ‘Books’. a) Create INDEX Books TO BookDetails(BOOK_ID, BOOK TITLE); ) Create INDEX Books (ON BookDetails(BODK_ID, BOOK TITLE); ©) Create INDEX Books AS BookDetails(BODK_ID, BOOK TITLE); ) Create INDEX Books OF BookDetaile(BODK_ID, BOOK TITLE); Answer: b) Explanation: The general syntax to create any INDEX is CREATE INDEX indexnane OW tablenane (columal, coluan2, So, option (b) is correct. u Database Management System: Assignment 3 ‘Total Macks: 20, Jame 8, 2022 Question 1 ‘Consider the following instance of the relation Gardens Name, Location, OpensAt, Glosesht, KnownFor) Tardens Wane Tecation | Opensdt RaowaFor Delhi | 0am Orchids TreeLand Anchuriune TreeLand Hyacinthe FloralParadise Celosia Suppose, Rt and 2 are defined as follows: ix v("openeat="10an’ (Cardens)) iy N(Location= Pune? (Gardens) What dttsibutes should replace X,Y, My W such that RL « R2- produces the tuple Celoaia | as output? Marks: 2MICQ 4) Kellane, YeLocation, MeLocation, NeKnownFor ») Keane, YeLocation, Mellane, NeknownFor ° jane, Y=KnownFor, M=Location, N=KnovaFor @) YeNae, YeKnownFor, Wellane, MeLocation Answer: b) Explanation: Option (a) and (c) ate incorrect 98 the common attribntes for the Natural Join do not have a common value for any tuple produced by Ri and R2. Option (dl) Is incorrect as the it produces the tuple [ FloraiParadise | Sunflover | Pune | Hence, option (b) is correct. Question 2 Consider the following instance of the relation Gardens ame, Location, OpensAt, Clo: KnownFor) sah Gardens Wane Location | Opensdt | Closoakt | knowPor Bageecha Delhi idan | 6pa | Orchids FloralParadice | Delhi | idan | 7.30pa | Sunflover Treeland | Montes | pm | 10pm | Anthariune Treotané | Mumbai | 1pm | topm | Hyacintns FloralParadise| Pune | éan_| iipm_| Celosia Suppose, Ri and R2 are defined as follows. RicThyane, Location(Gerdens) R2+((Myocation(“Closeskt="7.0pa’ (Gardens)))\(Tlyocation|“opensét=" Bax’ (Gardens))})) Which of the following Names will be produced by Ri + RQ? Marks: 2MCQ a) TreeLand b) Trestand, Bageecha ©) Bageecha, FloralParadise Answer: d) Explanation: R2 proiices Dethi, Pune, The only Garden present in both these cities is FloralParadise. Hence, option (d) is correct. Question 3 AC program, with embedded SQL allows the users to enter their ticket number whi is stored in the varinbles tno, With the help of an embedded SQL query, the progeam then displays the corresponding travel date and destination from a database with the following schema: ‘TravelReg(TicketWo, Destination, TravelDate, Reservationliame). Select the correct Embedded SQL query that shonld be present in this C program, Marks: 2 MCQ a) EXEC SQL declare ¢ cursor for SELECT FROM TravelReg WHERE tno*Tickettlo END-EXEC ) EXEC SqL declare ¢ cursor for SELECT TravelDate, Destination FROM TravelReg WHERE tno :Ticketto END-EXEC ©) EXEC SQL declare ¢ cursor for SELECT © FROM TravelReg WHERE Tickettlo=tno END-EXEC SELECT TravelDate, Destination FROM TravelReg WHERE Tickettlo#:tno END EXEC Answer: 4) Explanation: As per the syutax and semantics of embedded SQL queries (Refer to slide 11.15). Hence, option (4) is correct. Question 4 Consider the following instance of the relation Gardens ame, Location, OpensAt, ClosesAt, KnownFor) Gardens Wane Location | Opensdt | Closeskt | knowPor Bageocha Delhi | 10an | 6pm | Orchids FloralParadice | Delhi | idan | 7.0pa | Sunflower TreeLand | Mumbai | pm | 10pm | Anthuriune Treolané | Manbai | tpn | 10pm | Hyacinths FloralParadise | Pune | Gan | iipm_ | Celosia What is the result of the following Tuple Relational Caleulus expression? {tl5p € Gardens (t[KnowsFor]=p[XnownFor] /\ p[Location]="¥unbai")} Marks: 2MCQ a) [Treatand Warbai | Anthuriuae » | vusbai | Hyacinthe ‘p [ eetand [mba [aps [ope [anthoriaas ‘TeeeLand | Mumbai | tpa| 10pm | Hyaciathe ‘nthuriuae ® | Hyacinths Answer: d) Explanation: According to the syntax and semantics of Tuple Relational Caleulus, option (0) is correct. Question 5 Consider the following Entity Relationship Diagram: Which of the following options is (are) true? Marks: 2 MSQ. a) Participation of Product is total is Prod de }) The primary key in the relational schema for Receipt is {Nane, ItenMane, Producto}. ©) The primary key in the relational schema for Receipt willbe {ilame, Ttealiane, AgentPin} 4) Participation of Product is total in Prod ree. Answer: a), b) Explanation: Total participation is identifies by a double line. The primary key of a weak entity set contains the primary key of its ieentifving entity set. Henoe, options (a) and (b) are correct Question 6 Consider the relation Plan a(pnane, rank, satellites, dianster) What is the Doain Relational Calenlus expression equivalent to the statement ‘Select the names of those Planets which fave a diameter of more than 50,000 kms"? Marks: 2MCQ a) {pl3er,s,4> (p,r,2,d € Planets A p>50000) } ») { € Planets 4.660000) } ©) {

l3ke,8,4 (psr48,4> © (Planets) 4.450000) } 4) {pl3lp, $0000} ( € Planets ‘ p>50000)} Answer: b) Explanation: Options (a) and (d) are ruled ont as <> axe not present. Option (e) is syntac- tically incorrect (Refer to slide 12.28). Option (b) is syntactically and semantically correct 6 Question 7 Consider the following scenario: A Natural resource management company keeps a recond of different forests, identified by their names. A forest is associated with its location thal contains the Country and area in which the [orest is present, In cach forest, there are different types of trees that are also recorded by the ‘company. ‘Which of the following sehema correctly represents the Forest entity set? Marks: 2 MCQ 4) Forest (lane, Location, Trees) >) Forest (ame, Country, Area), Forest.trees (ane, Tres ) ©) Forest (Wiane, Trees), Forest Location (liane, Location, Country, Area) @) Forest (ane, Country, Area), Forest trees (lane, Trees) Answer: b) Explanation: Refer to slide 14.28 for details In the schema of option (a), the location is not properly explained. In the schema of option (c), the attribute Name cannot be primary key in the Forest relation, In the schema of option ((), the attribute Naxe eannot be primary key in the Forest. tre relation, ‘The schema in option (b) specifies the location correctly and eaptures the tree information in a forest-as well, Hence, option (b) is correct Question 8 Consider the following Entity Relationship Diagram: Book $2 Author |Auth_pub Publisher Which of the following is (are) true? Marks: 2 MCQ 4) Participation of Author in Auth. pub is total \) Participation of Publisher in Auth pub is total 6) A Book can be written by multiple Authors. 4) An Author can be associated with at most one Book. Answer: b) Explanatios ‘One Author m One Author may be related to zero or more Publisher. So, the participation of Author in ‘the relation Auth_pub is partial A Publisher may have one or mote Authors, So, the pact relation Auth pub is total, Hence, option (b) is cotrect According to the syntax of Crows feet notation, the following can be concluded. write many Books. ation of Publisher in the Question 9 Consider the instance of the relational schema Gallery(PaintingID, Artist, Theme) and Price(PaintingID, Cost): Gallery Price PaintingiD | Artist | Theme | | PaineingID | Cost 742 ‘T.Ray | Landscape ‘aia | 124000 aisT J.Ray | Portrait aisr— | 239876 BS Katier | Abstract, Bs | 1000000 2a | Littouston | Landacape 23__| s0000 How many tuples will be generated by the following Tuple Relational Caleulus expression? {UlSp € Gallery =9 € Price(t[PaintingID) = pPaintingID] A [artist] = plartist] a plane) \ ([Cest] — g[Coet] / p/Paintingi0] — q/PaintingID))} Marks: 2 MCQ a3 wa 8 @ 10 Answer: b) Explanation: According to slide 12.33, the given Tuple Relational Caleulus expression is equivalent to Gallery * Price in Relational Algenra, Hence, option (b) is correct Question 10 Consider the instance of the relational schema Gallery (PaintingID, Artist, Theme): Gallery PaintingID | Artist 7 Thay ater J.Ray | Portrait Ra Katia? | Abstract 23 | Lilouston | Landecape Which of the following Relational Algebra expressions produce(s) exactly the same tuples as present in this instance of GalLery? ‘Marks: 2 MSQ. ®) TipaintingID, Artist Gallery) ¥ Mpaint ingID, Thene(allery) ») Tipaintingto artist Gallery) # Threat, thene(Gallery) © Tipasnt ingiD, Thene(Gal0r7) » TlpaintingID, Thene( Gallery) @) paint ingiD, Thane Artiat (Gal2¢ry) * Tpyene (Gallery) Answer: a), d) Explanation: Option (c) is incorrect as Artist will uot be present in the output. Option (b) Js incorrect as it produces ? extsa tuples due to the redundant value J. Ray in the common attribute. Options (a) and (d) ate correct. 10 Database Management System: Assignment 4 ‘etal Maks: 20 June 20, 2022 Question 1 Consider a relational schema OalineClass(class1D, classLink, Subject, Mentor, Duration) Which of the following set of functional dependencies should be chosen so that OnlineClaas can be in 2NF but not in 3NF? ‘Marks: 2MCQ a) classID + {classLink Subject} classLink + Duration Mentor > Subject ) {claseID,claseLink} + {Subject ,Mentor Duration} {Mentor Subject} + (claseLink,Duration,claselD) €) {claseID,Mentor} — {classLink,Subject} classLink + Duration @) {claseID,claseLink} + {Subject Mentor Duration} Nentor > claseLink Answer: ©) Explanation: For option (b), the candidates keys are {class1D, classLink}, {Mextor, Subject} which are present on the L.H.S of hath the finetional dependencies. Ths, it makes OnLineClaas to stay in BCNF, For option (a), the candidate key is {claseID, Mentor}. Since partial dependency is present in the FD set, it allows alineClass to be in INF. For option (d), the candidate keys are (clasaID, claseLink}, {classID, Mentor}. Hence, there is neither any partial dependeney nor any transitive dependency as the RLS of the second FD contains a key atteibute, Hence, tis in SNF. In option (¢), the candidate key is {class1D, Mentor} There is no partial dependeney and there is a transitive dependency. ‘Thus, option (¢) is correct Question 2 ‘The following dependencies hold ina relation Placement (JoBID ,Company, Position, Salary) JobID > Conpany [Position, Company} > Salary According to which of the following rules, {JobID, Position} + Salary holds? Marks: McQ 8) Decomposition 1b) Augmentation 6) Paendorteanstivity 4) Trasitivity Answer: ¢) Explanation: According to Pseudo-transitivity rile, if x determines ¥ and ¥2 determines then XZ determines ¥, Hence, option (c) is correct. Question 3 Consider the following instance of Market relation: Warket MarketName | Product | Stock | Spendviee Shampoo | 12 SpendWise | Spicesiz [6 Spendiise Cookies | 6 ShopLuck ‘Shampoo | 20 WarkIe Cakonix | 60 MarkIe Chocolate | 12 Which of the following funetional dependencies hold on Market? Marks: 2MCQ a) MarketNane + {Product, Stock} ) (Stock, Markettiane) + Product ©) {Product} + Marketiiame ) (Marketliane, Product} > Stock Answer: d) Explanation: Only for option (i), the attributes on the LHS attributes on the RH.S, Hence, option (d) is correct, S can uniquely identify the Question 4 Consider the following relation: Measurenent (censor, device, dataform, uprange, lovrange, delay, status) with the following functional dependency set (F): FDL: {sensor, device, status} +> {dataform, uprange, lovrange} #02: seneor “> {delay, status} FDS; {status, delay, datafora} + {sensor, device} Measurement has 3 candidate keys. Keys KL, K2, and K3 have 2, 2, and 3 attributes re- spectively. The database admin issnes the following order A needs to be appended to the R.H.S of FD& so that only K3 and (K1M.K2) become the ean. dlidate keys of Measurement, Find & aud 4, Marks: 2MCQ a) vice, iat b) Xedelay, ist ©) Nedataform, i=2 4) Aeetatue, & ‘The 8 candidate keys of Measurement are levice, sensor} ldataform, sensor} Jdataforn, delay, status} KIN K2 =sensor For sensor to be the candidate key, elther device or dataforn needs to be appended to the R.HLS of FD2. Hence, option (c} is correct, Question 5 Consider the following relation: Measurement (sensor, device, dataform, uprange, lovrange, delay, status) With the following functional dependency set. (F): {eensor, device, status} + {dataform, uprange, lovrange} sensor “+ (delay, atatu} {evatue, delay, datafors} + (sensor, device} Which of the following funetional dependencies will not be preseut in the C F after the application of Union Rule on the final functional dependencies? meal Cover of Marks: 2MICQ a) {eensor, device, status) + {datafora, uprange, losrange} d) sensor -> {delay, status) ©) {evatua, delay, dataform) + (sensor, device) 4) (sensor, device) > (dataform, uprange, lowrange Answer: a) Explanation: We can see that the closure of (sensor, device) still ‘Thus, status is extrancous in the first FD (L-H.S). No other attribute can be removed from any other FD after removing status, Thus, {sensor, device, status} — {dataform, ‘upranga, lowrange) will not be present in the Canonical cover of F. Hence, option (a) is neludes atatue Question 6 In a relation Weather (Country, City, Dayle, Tinelir, ProbRain, ProbWind, ProbTemp) [country Csty, Dayllo} uniquely identifies the (ProbRain, ProbWind, ProbTeap). Tamelir is identified by Dayo. Country is determined by {ProbRain, ProbTemp}, What are the non- prime attributes of Weather? Marks: 2MCQ 8) Both City & Dayo ) Both Countey & ProbTenp ©) Both Probiind & Timer 4) Both ProbRain & Probisnd Answer: ¢) Explanation: According to the problem, the following FDs bold {Country, City, Daylio} + {ProbRain, ProbWind, ProbTeap} Daylfo > Tinelir {Probaain, ProbTesp) + Country ‘The candidate keys are (City, Daylio, Country} and (City, Dayllo, ProbRain, ProbTesp} Hence, option (c) is correct. 6 Question 7 In a selation Weather (Country, City, DayWo, Timelir, ProbRain, Problind, ProbTesp) (Country, City, Daylio} uniquely identifies the (ProbRain, ProbWind, ProbTeap). Timelir is identified by Dayle. Country is determined by {ProbRain, ProbTemp}. If Veather has 1o ‘be normalized to 2NF. which of the attributes will be present in both the decompositions of Weather? Marks: 2 MCQ 8) Country by) Time 6) ProbRain 4) Daytio Answer: d) Explanation: The FD that causes the violation of 2NF is DayNo > Timelir, Hence, one of the decompositions should be Weather (Dayo, Tinelir). For the decompesitions to be lossless, the common attribute should be a superkey in atleast one of the decompositions. In Weather DayWo, Timelir), the FD Daytio —> Tinelir holds and Daytio is the candidate key. Hence, the other decomposed relation should be Weather2(Country, City, Dayle, ProbRain, ProbWind, ProbTemp). Thus, option (¢) is correct Question 8 Consider the following relation VehService (Vehicle, Golor, Capacity, Wheels, Owner) ‘with the following fuetional dependency sets: {Vehicle, Color} + Capacity eels + {Venicle, Capacity, Owner) FDI: Vehicle -+ [Color, Capacity} ¥D2: Wheele + (Vehicle, Gener) ‘Which of the following statements is true? Maris: 2 MCQ 1) Neither $1 covers $2 nor $2 covers Si 1) $2 covers $1 but $1 does not cover $2 ©) 81 covers $2 butt $2 does not cover $1 4) Both 81 covers $2 and 82 covers St ‘The FD Vehicle + (Color, Capacity) of $2 cammot be derived from $2 fas (Vehicle) * dots not contain {Color, Capacity} in $1. All FDs of 81 can be derived from $2. Hence, option ()) is correct Question 9 Consider the relation PollutionControl (PolType, Cause, Severity, Effect, Measure, TargetZone) with the following functional dependencies: FDI: PolType + Cause ¥D2: Severity + Effect ¥D3: {PolType, Measure) + TargetZone ¥D4; {Cause, Effect} + {Neasure, Severity} ‘Which of the following options is true? 8) PoLtutionControt has 1 candidate key and is in INF. }) PoLlutionControl has 2 candidate keys and isin INP. ©) PoliutsonControl has I candidate key and isin 2NP. 4) PoLlutionControl has 2 candidate keys and isin 2NF. Answer: b) -e partial dependeney occurs in FDA, itis in INF. Hence, option (b) is correct Question 10 Marks: 2 MCQ ‘The candidate keys of PollutionControl are {PolType, Severity} & {PolType, PollutionControl (PolType, Cause, Severity, Effect, Measure, TargetZone) with the following functional dependencies: FOL: PolTypa + Cause FD2; Saverity + Effact F038; {PolType, Measure) + TargetZone ¥o4: (Cause, Effect} + (Neasure, Severity} ‘The relation is decompased into the following PollutionControlt (PolType, Cause, Severity, Effect) PollutionControl2 (PolType, Severity, Measure, TargetZone) Which of the following is true about the decomposition? Marks: 2 MCQ 2) Both loses and dependency preserving 1) Neither lastess nor dependency preserving 6) Lossless but nat dependency preserving 4) Lossy but dependeney preserving. Answer: ©) Explanation: The union of attributes of PollutionControlt and PollutionControl2 encompass all the attributes of PollutionCoxtrel. The common attribute between the to dlecomposed relations are PolType, Severity which isthe key in PollutienControl1. Hence, the decomposition is lossless. Frot PollutionControl i, FDL and FD2 can he derived. FDS can be derived frou PollutionControl2. However, FD4 cannot be derived from these decompositions, thus making them violate the de- pendency preserving criteria. Hence, option (c) is correct 10 Database Management System: Assignment 5 Total Maks: 20 June 27, 2022 Question 1 Which of the following specifies how an application server communicates with the external web? ‘Marks: 2 MCQ a) HTP by sMerP 6) Web browser a) car Answer: «) Explanation: Common Gateway Interface is a standard interface between the web and ap- pli (Refer to Lecture-21), So, option (4) is correct. Question 2 ently the incorrect statements) from the following? Marks: 2MSQ a) Javascript and AJAX technology are used to design server-side applications. 1) Serviet runs inside application servers 6) 308 connections always stay connected 4) Java Server Page is platform independent Javascript and AJAX technology are used to design client-side applications ‘and JDBC connections stay connected until the elient disconnects, Hence, options a) and c) are the answer. Question 3 What will be the availability of the Redundant Arrays of Independent Disks (RAID) system, if the Mean Time Between Failure (MTBF) is 25 days and the Mean Time To Repair (ATTR) the system is 18 hours? Marks:2 MCQ a) 97.091 ») 96.02% 6) 58.14% 4) 30.25% Answer: a) Explanation: Mean tize between failures is the average time between failures, ‘Mean time between failures (MTBF) = total available tine / number of failures. Mean time to repair is the average time taken to repair the system. ‘Mean time to repair(MTTR)= total vnavailable time /nnmaber of failures Availablity = Total available time /(total available time -+total unavailable time) AUDLEY (0) = TTBS TR ian, AST % = 97.09% Hence, option a) is correct, Question 4 Suppose there is a 256 gigabyte flash storage system, with 4 kilobyte page size. The adelress of each page is stored In the memory as an array called a fash translation table. If the size of ‘the flash translation table is 512 megabytes, what is the maximum address size of a page? Marks: 2MCQ 2) 8 bytes b) 10 bytes 6) 82 bytes 4) 64 bytes No. of flash pages Suppose, ench address requires p byes ‘Therefore, the lash translation table would be = p x 64 x 10 So, p = isthe = 8 bytes 256 gigabyte _ 256 x 10 Apatiesyte = axa Question 5 enti the correct statemes (s) about the following RAID levels? Marks: 2 MSQ 48) RAID 0 provides byte-level striping with mirvoring 1) RAID 4 provides disk mizvoring without steiping. «) RAID 8 provides hyte-level striping with dedicated parity checking 4) RAID 5 provides Byte-level striping without paeity bits Answer: b), 6) Explanation: RAID 0 provides block-level striping without parity or mirroring and RAID S provides block-level striping with distributed parity. Therefore, these two statements are given in options a) and d) are incorrect. Hence, options b) and ¢) are the answers. Question 6 Suppose, there is @ 512 gigabyte magnetic disk with 256 sufaces and 1024 tracks per surface It has 512 sectors in each track, what will be the size of one sector? Marks: 2MCQ a) 512 bytes >) LKB 9) 2B 4) 4KB Answer: d) Explanation: Capacity of a magnetic disk per surface x Number of sectors per track x Number of bytes per sector So, the size of a sector Capacity of a magnetic disk ‘Total munber of surfaces x Number of tracks or bytes 2 pyces So, the number of bytes per sector 2! bytes 6 Question 7 ‘Which of the following layer is wot present in a typical 3-tier Mobile Application architecture? Marks: 2MCQ 8) Application layer ) Presentation layer ©) Business layer 4) Data layer A typical 3-tier Mobile Application Architecture consist: Presentation layer Business layer Data layer Hence, opt ma) is the answer Question 8 Consider a database management system that organizes its records ofa file in sequential order and one block contains only whole records. A file containing faculty records has 824 records ‘and each record is 40 bytes long. Ifthe disk block size is I kilobyte, and the block pointer size is 8 bytes, how many blocks will be required to store the faculty file? Marks: 2 MEQ a) vp 32 ©) 8 aa Answer: ¢) Explanation: One block can store only whole recor So, one block can store n mmimbers of whole recoeds and one black pointer. One record size = 40 bytes Disk block Sze = 1024 bytes Disk block pointer = 8 bytes Actual storage size of one block = (1024 - 8) = 1016 bytes n= 12/40 = 25.8 ~ 25 So, maximum of 25 records can he stored in a block ‘There are 824 records in the fle, hence the required number of blocks = 824 / 25 = 38 Question 9 In aDrawing Competition, participants individually cau euzoll tele names for the competi- ton. There ate many groups in te competition depending on the age of the particépants, A participant can participate in only one group and a group consists of multiple participants. Each group has a unique name (GName) and a participant also has a unique id. The result, (score) of each group is maintained separately. Which of the following statement(s) are incor- rect? Marks: 2MSQ. 1) Entity Group does not have any primary key ) Participate is a one-to-many relationship between Group and Participants, ©) Participate isa many-to-many relationship between Group and Participant. 4) GNane may be the foreign key of Participate relation between Group and Participant. Answer: a), ©) Explanation: If we draw the ER diagram of it, we can see there will be 0 relationship between Group and Participant. Gname isthe primary key of the entity Group table, Hence, can be te foreign key of Participate relation between Group auc Partiespant. Comme > [sou LL — — \— ») Answer: d) Explanation: In 2-3-4 tree insertion, we start from root and traverse till the leaf node where: key is to be inserted. While traversing, if we find! a node whieh is full, we split it. When we insert 6, we find root itself is full, so we split it. When we come cdowin to leftmost leaf, we find ‘that the leaf is also full, so we split the leaf also. Refer Module 27 slide 926, Question 6 Identify the correct B-tree of order 3, generated by inserting 27, 11 and 77 Marks: 2MCQ a) ») ° @) Answer: ¢) Explanation: In a B*-tree of order 3, every non-toot node ean have maximum of 2 keys ‘After insertion of 27, andl LL the teee will be: =» After insertion of 77, the node will spit and the new tree willbe: ZZ sD 6 Question 7 In an open hashing system, collision is resolved using linear probing. In the given system, the hash table is of size eight starting with index zero, The hash fnetion is:(Sx + 2) mod 7 where x is the value of the kay. Assuming that the lash table is intially empty, whieh of the following depicts the contents of the hash table when sequence 10, 23, 87, 41, 45, 53 is Inserted into the table? Marks: 2MCQ = 53, 10, 45, 41 10,41, 45 6) 58,28, 97, 10, 45, 41,. 4) ., 58, 23, 37, 10, 45, AL. In open hashing, the set of buekots is fixed, and there are no overflow chains. Ifa bucket is full, the system inserts records in some other bueket in the initial set of buekets ‘One poliey is to use the next bucket (ia eyelie order) that has space: this policy is ealled linear probing. (942) mod 7 = 10, (3x42) mod 7 23,4 10, (8x+2) mod 7 =1 when x=87 + collision ocens at index position 1. As next available index: position is 2, hence it will be occupied = 28,37, 10, (8x+2) mod 7 =4 when x= + collision ocenrs at index position 4. As next available index: position is 5, hence i will be occupied 237, 10, 45, (3x+2) mod 7 =0 when x 3.28, 37, 10,45, 41, - Question 8 Consider the table Flover: FID [WANE] SESH si | Rose | Summer 149 | Jaaaine | Rainy 262 Lotus | Fata 286 | Daliya | Winter 265 | Orchid | Summer 360 | anya | Winter ‘378 [Lily | Rainy Consider the bitmap index for the SEASON field, with $1, $2, $3, and $4 representing different SEASON, Select the cortect option for which the bitmap index value of SL, $2 will be as follows: Marks: 2 MCQ PEP PTepPy] Toy TtToq ry 4) Summer and Winter >) Summer and Aut ©) Rainy and Winter 4) Rainy and Autumn Answer: ©) Explanation: if we put true (1) and false (0) for the given valle of the SEASON Field we get for Rainy 1, and Winter $2 So, option (c) is correct. Question 9 If the inclex entries are inserted in sorted order into a BF tree, choose the correct option(s) {rom the following statements, Marks: 2 MCQ a) The new entries get directed to last leaf node ifthe index entries are inserted in ascending order. 1b) When last leaf node gets filed, it ill split into three, ©) IF the leaf node splits when inserting in ascending order, the right node is left untouched and the insertions take place on the parent node, 4) Except for the frst and last leaf, the occupancy of nodes is about 100 percent if insertion happens in descending order. Answer: a) Explanation: If the indes entries are inserted in ascending order, the new entries get dic rected to the last leaf node, When this leaf node gets filled, it is split into two. ‘This makes the oceupaney of the leaf nodes about 50 percent, except for the last leaf IT Keys that are inserted are sorted in descending order, the above situation would still occur Dut symmetrically, with the right node of a split never getting touched again, and occupancy ‘would again be 50 pereent for all nodes other than the first leat Hence, ouly option a) is correct, Question 10 How many maximum numbers of keys, a B-tree of order 4 ean store? The height of the tree Js 5 and the root node is assumed to be in height zero Marks: 2MCQ 9) 8101 ») 4095 ©) 2047 a) es Answer: b) Explanation: A B-tree of order # and height b will have the maximmm number of keys when all nodes are completely filled. of order 4 can store 3 keys. of order 4 can have d children, So, can have dx} + 3 keys Similarly, maxinmun munber of keys ina Betree of height = (m1) keys Here, m=4 and h=5. Hence, maximum keys = (41-1) So, 4° — 1 = 4006 - 1 = 4095 ) is correct. 10 Database ManagementSystem: Assignment7 Toa Masks 100 September 26, 2022 Question 1 Consider the following schedule $ involving five transnetions Ty, To, Tj, Ta ane Ts Marks: 2 MCQ ROY Eiee} B® WOR) RO Wa a} R(X) denotes read operation on data item X by transaction T) W(X) denotes write operation on data item X by transaction Ts ‘Choose the correct option for the above transaction schedule 8) The schedule is only view serializable schedule ) The schedule is only conflict serializable schedule. ©) The schedute is both view and conflict serializable schedule 4) The schedule is neither conflict serializable nor view serializable schedule. Answer: ©) Explanation: If we daw the precedence graph of the transactions as show in Ue fole Towing, we can observe that the graph has no eye, So, the above schedule is a conflict serializable schedule. All conflict serializable schedules are view cerializable too, I So, option (¢) is correct Question Z Consider the following schedule § involving five transactions T), Tp, Ty Ty and Ty Marks: 2MCQ RLPpTRpn ps RO RO) WO RY WY ¥@ WEY R(X) denotes read operation on data item X by transaction T. W(X) denotes write operation on data item X by transaction 7; entify the correct option(s) that represent the order of execution of all transactions of the above echedule &. a) TISTISTISTIGTS b) TITS 37173472 9 MSTIS15 412473 4) TOTS STIST24T3 1 If we draw the precedence graph of the transactions as shown in the fol- lowing, we can observe that the graph has no eyele. So, the above schedule is a conflict serializable echedule. ‘All conflict serializable schedules are view serializable too, All possible topological orderings of the above precedence graph will be the possible conflict serializable echedule, Hence, the correct order of execution of all transactions is: (T4+T5+T1 +7293) So, option (4) is eorreet Question 3 Consider the following schedule § involving four transactions 7), Tp, Ty and Ty, Marks: 2MCQ R(@) wey R(X) denotes read operation on data item X by transaction T;. W(¥) denotes write operation on data item ¥ by transaction T; enti the possible number of conflict serializable schedules of the above schedule 5, a) v2 I we draw the precedence graph of the echedule, we can observe that the graph has no eyele. Hence, the above schedule is conflict serializable schedules, All possible topological orderings of the ahove precedence graph will be the possible conflict serializable echedule, LT T2571 Ts 2113 T4124 T3 3 MST13 12473 Hence, option e) is correct. Question 4 Suppose in a database, there are four transactions Ti, Ta, Ty and Tj, Transaction T; is ‘waiting for trangactione T; and Tj, traneaction T) is waiting lor transaction Ts, and ‘transaction T; is waiting for transactions Tz and T; to relense a data item, enti the correct ¥ait=for graph for the above scenario. Marks: 2MCQ a) Vy » & \y 9 &) ® “ 1S) ¢ When T; requests a data item currently being held by Tj, then the edge T; + werted in the wait~for graph, T; + 7), implying that T; waiting for T; to release a data item, Hence, option d) is correct. Question 5 Consider the following echedule § of transactions 7; and Ts, Mavis: 2MICQ ‘The read operation on data item A is denoted by read(A) and the write operation on data item & is denoted by write Ce). Ty Tt ead) i=A-200 write) read(@) Toup:=Cs0-7 Ci=C-temp readB) Bi=B+200 write) write) read(D) — Which of the following is TRUE about the schedule 8? f) $ is serializable only as Ti, Ts ) Sis serializable only as Te, Ti. 6) S$ is not serializable either as Ty, Ta ot Tp, Th. 4) S is serializable both as Ty, Tz and Te, Th. Answer: d) Explanation: First, swap all non-conflicting instruction of the above schedule 8, Here, 7; and Ty both are working on different data items. So, $ is serializable both as Ty, T: and Ts, T, Hence, option (d) is correct, Question 6 Mentfy the incorrect statement(s) about the lock compatibility matrix given below, where S deuotes a ehared mode Lock and X denotes an exclusive mode lock, Marks:2 MCQ =| % S| True | False 1 Falee | Fale a) Ifa transaction holds a $ Lock on a data item, other transactions will not be allowed to obtain a X Lock on the same data item. }) Ifa transaction holds a $ Lock on a data item, other transactions willbe allowed to obtain 8 lock on the same data item, ©) Ta transaction holds an X lock on a data item, other transactions are not allowed to obiain a X Lock on the same data item. 4) If transaction holds an X lock on an item, other transactions may be allowed to obtain. 8 lock on the same data item. Answer: d) Explanation: As per lock based protocols. Refer Module $4 slide 10, 6 Question 7 Suppose in a database, there are four transactions Ty, Tp, T; and T; with timestamp 10, 20, 30 and 40 respectively. T; is holding some data items which Tj, T> and T, are reqnesting to acquire, Which of the following statement(s) is (are) correct in respect of Wait-Die Deadlock Prevention sclieme? Marks: 2MSQ a) Transaction T; and T; will wait for 7, to release the data item. ) Transaction 7; and Ty will wait for Ts to release the data item. ©) Transaction T; and T, will wait for Ty to release the data item, 4) Transaction 7; will rollback. Answer: b), d) Explanation: In Yait-Die Deadlock Prevention schesne: Oder transaction may vait for younger one to release data item, (older means smaller timestamp) Younger transactions never wait for older oues; they se rolled back instead. ‘Transactions T, and are older and 7, is younger to Transaction Ty Hence, options b) and d) are correct. Question 8 Consider two transactions given below where Tock-X (A) denotes T; has obtained an Exelusive-aode Jock on data item A and Lock-$(A) denotes T, has obtained a Shared-node lock on data item ‘A. read(A) denotes read operation on data item A by the transaction T;. weiteCa) denotes write operation on data item A by the transaction 7), Marks: MCQ 7; TSO] reek Teeek@y| | ted) Feat area] [isloer@y “comit | [ratoek@ay Which of the following statement(s) is/are true? a) Both T; and T follow the strict two-phase Locking protocol, }) Both 7) and Ts do not follow the strict two-phase locking protocol, ©) T; follows the 2-phase locking protocol only but Tz follows the strict two-phase locking protocol. 4) 7; follows the strict two-phase locking protocol only but 7; follows the rigorous ‘evorphage Locking protocel. Answer: ©) Explanation: Transaction 7; unlocks one Exelusive-mede lock before commit. That is ‘why, it does not follow the etrict two phage locking protecol as well as the rigorous two-phase locking protocol. It is following two-phaee Locking protocol only. The frst Js the growing phase in which itis acquiting locks, the second is one in which itis releasing locks, [But transaction 7) unlocks the Shared-node Lock before commit and unlocks the Exelussve-mode Lock alter commit, That is why, it follows the strict two phase locking protocol but not the rigorous two-phase locking protocol. Hence, option (¢) is correct. 8 Question 9 Consider two schedules S; and Sp as fllows Marks: 2 MCQ Sr ] Ss Tr Th] Ti 7 Tec KO | Pease Fea Feed write) Tock S08) rr) read ead(6) walock®) wite@®| | umlock() Tock-5(A | Toa KO ead(a) | ead(a) Tee) 1 write (i) raad(B) | Tock XE) walock @) ead) walock() write (®) wale unlock A) aloe) unlock(3) ‘Mentify the correct statement fom the following which relates to whether the schedules are deadlock free. Please note that if any schedule sulle from deadlock, some operations of ‘the transactions in that sehednle may’ not he executed, ) Both $1 and Swill suffer from deadlock D) 5; will suffer fom deadlock, $, will not suffer from deadlock. ©) S; will not sulfer from deadlock, S> will sufer from deadlock, 4) Neither $; nor will suller from deadlock, Answer: b) Explanation: In Sj, Tj is holding exclusive sode lock on (A) and Tp has requested shared node lock on (A). While oue transaction is holding exeluaive mode Lock on a par- ticular database, no other transaction ean acquire any shared mode lock on (A) unless the lock is released hy the former transaction (which is holding exclusive mode lock on the data item). Similarly, T; is holding exclusive lock on (B) and T; has requested shared mode lock on @). tions and will not release the exclusive mode lock on (B). ‘This, in turn, restricts transaction Tp to acquire shared mode lock on (A). Similarly, transaction T; cannot acquize shared mode lock on (B). ‘Thus, both T; and Ts are waiting for each other to release resources, Hence, Si is going to suffer from a deadlock, In 2, Ti has acquired shared mode Lock on (A) and (B) and T; released locks on data items A and B, Then, Ts wants to acquire exclusive mode lock on (A) and (B) and granted to Ts and no deadlock occurs in $2. Hence, option (b) is correct 9 Question 10 Consider the following two schedules St and $2. Marks: 2MSQ 3 3 Th es HOD ROY we wor OD CORR ve RW omar Wa AO, ORR R(X) denotes read operation on data item X by Transeetion T; W(X) denotes write operation on data item X by Transaction T: Which of the following statement(s) is/are true for the above two schedules SI and $2? a) Both scheslules $1 and S2 are Recoverable Schedule, }b) Both schedules S1 and $2 are Cascadeless Schedule, ©) The schedule $1 isnot a Recoverable Schedule but the schesiule S2 is Cascadeless Schedule, ) The schedule SI is not a Recoverable Schedule but the schedule $2 is Recoverable Schedule, Answer: ©), d) Explanation: Racoverable Schedule: If transaction 7; roads a data item previously write ten by a transaction T; the commit operation of T; must appear before the commit operation of I). Cascadeless schedules: For each pair of transactions Z; aud 7; such that Z) reads a data item previously written by T;, the commit operation of T; appears before the read operation of I) In SI, Zs reads the data item X which was previously written by Ti: 7 committed immedi- ately after the rend(X) and write(X) operations . Hence, the schedule is non recoverable schedule, In $2, 7 reads the data item X which was previonsly written by 7)" 7; commited before read X operation by Ts. Hence, the schedule is only recoverable schedule as well as Caacadele: schedule, Hence, options (e) and (dl) are correct 10 Database Management System: Assignment 8 ‘Total Maris +100 October 3, 2022 Question | Assume an immediate database modifiation scheme, Consider the following log records for ‘transactions TO, TI, T2, T3 and TH ‘Marks: 2MSQ ‘steps | Details of Tog 7 (70, start) 2 (Ti start) S_|_1H, x, 100, 200) a (Fi, commit] S| Teheckpoine (To) ) e 7 @ 70,¥,200, 400) TZ, start) (70, commit) z Te stare) 70 (74, start) 41 _|(9,2,400 ,600) T2_| (74, W, 600, 1200) FE} (74, commit} If there is a crash jnst after step 13 and the recovery of the identily the correct actions for the above seenario. ystem is successfully completed, a) After recovery completion, value of X will be 100 D) After recovery completion, value of ¥ will be 400. ©) After recovery completion, value of Z will be 600, 4) Aer recovery completion, value of W will be 1200, Answer: b). d) Explanation: In the immediate database modification scheme, during recovery alter a crash, a transaction needs to be redone if and only if both (T,, start), (,, commit) are present in the log, Otherwise, undo is required ‘Any transactions that are committed belore the last checkpoint should be ignored(updates alrendy outpnt to disk due to the checkpoint). Redo list contains transactions {T0, T4} and undo list contains transactions {T2, TS} and for transaction {TI} no action is needed hecause itis already committed before checkpoint. After recovery completion, for TO the value of Y will be 400, for TS the value of Z will be 400 and for TA the value of W will be will he 1200, Hence, options (b} and (A) are correct. Question2 enti the cost estimation of a query evaluation plan, if 2000 blocks are required to be ‘transferred from disk and the required number of @isk seeks are 50. ‘© Time to transfer one block: tr = 4 milliseconds © Time for os A seconds seek fy Marks:2 MEQ 8) 4 Seconds 1) 8 Seconas 6) 10 Seconds 20(4 2: (rante='2022-06-12" (Tage>20(Patients * Appointaents))) 3 TTapane(Manaae ¢_onaia Doctors » Appointaenta)) QU: Thaname, d.enai(Doctors x Appointments) ‘Mentify the correct options from the optious given below. 8) QL is equivalent to Q2, 1) Ql is not equivalent to Q2 ©) Q3 is equivalent to Qu. 4) QB is not equivalent to Qi. Answer: a), d) Explanation: QI and Q2 will give the same result beease according to transformation rrules, selection operations are commutative, QB and Q4 will not give the same result because according to transformation rules, only the last in a sequence of projection operations is needed, the others can be omitted. Hence, options a) and d) are correct. Question 9 Consider the following relational sehen: Marks: 2MICQ Patienta(pid, pase, age, p.enail) Doctors(did, daane, qualification. d.esail) Appointaenta(pid, did, date, tine) Consider the following query of the above relation: Select Patients.pnane, Doctore.daane From Patients, Doctors, Appointments Where Patients.pid-Appointments.pid and Doctors.did-Appointments.did and Pationts.age60; [Hentify the most optimizes relational algebra for the above query using heuristic based query optimization technique. 4) Mipatients.puane Doctors .dnase (opatients.pid-Appointuents .pid Doctors. dic (Patients (Doctors » Appointments))) pointnente.did-Patiente.age=S0 v) Tpacsenta.pnane Doctors .anane((Mpoctors.dia,Doctors.dnane Doctors) x (lppotneaeats Coparients.ages50 patients .pid,Pationts.pnane,Patients.age(Patients))))) Mpationts. pane Doctors. dnane (Mdoctors.dnane\Dasws)) ¥ (Appointnents Copatients agen80 Mipatients pid, Patients, paane, Patients. age(Patients))))) 4) Mpatitents.pnane Doctors. dnane (Patients age-50 (Patienta x (Doctors x Appointuents))) Answer: b) Explanation: Performing selection and projection as eatly as possible reduces the size of the relations that are to be Joined later. So, i is better to perform projection with required attribute and then perform selection, Hence, option b) is correct. 10 Question 10 Consider the Relational Algebra expression given below: P my (GPR) where P, g, and R are relational algebra expressions. Mentify the correct equivalent relational algebra expression of the above relational algebra expression. ‘Marks:2 MCQ a) P me (me R) 1) (Poe Q)(P m9 R) ©) (@ 0) =) 4) (P me 8) — xo) Answer: b) Explanation: As per the equivalence rules of Relational Algebra expressions.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy