Download as pdf
Download as pdf
You are on page 1of 61
POSTAL Study Course Computer Science & IT Objective Practice Sets Database Management System Sl. Topic 41. TheRelational Model 2. Database Design and Normalization 3. Relational Algebra | 4. SOL 5. Transaction 6 7 rency Control Techniques File Organization and Indexing 2018 MADE EASY Students Oniy For a4 a2 as a4 as Which one of the following NULL values can not be used in the relational mode!? {@) To fill column in tuple when that column does not really exist for that particular tuple, To leave columns in a tuple marked as ‘unknown’ when the actual value is unknown, (0) Toallow duplicate tuples in the table by filing the primary key column(s) with NULL. Toopta tuple outof enforcement ofa foreign key, ©) (a) Aweak entity (a) is an entity with no attributes beside its key. (©) inherits part ofits key from the ‘parent entities to which itis related, (©) is an entity with no key. (d) None of these, Inthe Relational Model, the number of attributes ‘and number of tuples in a relation are termed as —__and respectively, (@) Cardinality, dornain (b) Degree, cardinality (©) Domain, degree (d) Cardinality, degree Making a change to the conceptual schema of a database but not affecting the existing external schemas is an example of (@) Physicaldataindependonce (0) Logical data independence (© Concurrency control (@) Integrity control ‘The data base admini coordinator between the. (a) DBMS, data base (b) application program, data base (©) database, users (6) application programs, users in effect, the and the ator i eed The Relational Model as a7 as Consider the following ERD diagram illustrating the relationship of customers and banks. Ga) a <> OT aa Select rom among the following, candidates for relations, if the above ERD is mapped into a relational model. 1, Customer(NID, CName) 2, Account(DateAcciCreatad, BName, CName) 3, Bank(BanklD, NID, BName) 4, Bank(BanklD, BName) 5, Account(BankID. NID, DateAccCreated) (@) 1,2and4 (©) 1,4and5 (© 1,3and5 (@) 1.2and4 (Choose the incorrect statements. 1. Innetwork model, data is represented by a collection of records, and relationship arnong data are represented by links 2. Inhierarchical model, data and relationships ‘among data are represented by records and links respectively In hierarchical model, the records are organized as acollection of arbitrary graphs. 4, In network model, the records are organized as. collection of trees. (@) tand3only ——(b) 2and only (©) Sand4only ——(@) Allarecorrect Manager's salary details are hidden employee, This is G3 MADE ERSY (0) physical level data hiding (d) none of the above Q.9 The following diagram represents the dependent entity from an Entity Relationship Diagram. Select the characteristics which are not represented by the above diagram. (@) BithDate is a derived attribute (6) Genders an atomic attribute (©) Address is a multivalued attribute. (@) Name is a key attribute Q.10 Consider the following ERD diagram depicting the relationship of an employee and supervisor. ai =< Ei GEO amiovee Supervise 1 \Whichisthe possible relations ifthe above ERO ismapped into relational mode’? (@) Employee (EmplD, BirtnDate, Salary, Nama(FrstName, MiddieName, LastName) (b) Supervision (EmplD,BithDste, Salary Name(FestName, MidcleName, LastName) ‘Emald) {c) Supervisor (SupervisorlD, BirthDate, Salary, Name(FirstName, MiddieName, LastName), EmpiD), (EmpID}) (@ Employee (EmpiD, BirtnDate, Salary Name(stNare, MidcleName, LastName) ‘SupervisoriD) wunwmadeeasy.in & Postal Study Course BUHE] MADE EASY Dams | Q.11 Consider the following ER diagram The minimum number of table needed to represent M, NP, Rt, Ris, (2 ©) 3 4 @ 5 Q.12 Match List-| with List-Il and select the correct answer using the codes given below the lists: List-1 List-ll A 1. Identifying relationship B. <0) 2, Weak entity ©. ES 0. onivedeneute D. © 4, Muttivalued attribute Codes: A Bc OD (a) oe ae Ceo @2 3 4 14 @ 1 4 38 2 Q.13 Which of the following is true with respect to generalization 1. Itisthe process of identiying subsets of an entity set that share some common characteristics but still contains some differences. 2. Ittells that a class inherts properties of base class. (@) Only (b) Only 2 (©) Bothtand2 ——(d) Noneof these Objective Practice sets [Ey a1 ais GF Computer Science & IT Consider the following ER model: 2 ‘aD vs fa tons }[itemid How many minim ER model? bles are required for this A is relationship with 1 : 1 cardinality, 30% participation at E, end 70% participation at E, tend which isthe best possible design? (@) E, and E, kept separate with foreign key at E,end (0) E, and E, kept separate with foreign key at E,end (©) E,and E, kept separate with foreign key at E, as well as E, (@) E,and E, merges into single table with no foreign key fammace easy Ggmape Ensu Q.16 Consider the following ER diagram with three entity seis E,, E,, E, and relationship set R 5 5 |e IVE,, E,and E, has 80, 30, 100 and 400records respectively. What is the maximum number of records of entities that could be in the relationship set A? ‘wwmmadeeasy.in MADE ERSY EERIE the Relation 1 © 2 &) 3 © 4 &) 5. Model 10. @ 11. @ 12 © 18. © 15. EESEEEII The Relational Model 1. (0) Primary key column never contains NULL -&. Option (c) can not be used. Remaining options can use NULL. 9. (d) Ellipse with underlined attribute is known as key attribute. 10. (a) The given ERD shows the self recursively relationship among Employees. 1 is supervisor 2is supervises. The possible relation is Employee (Emp Io, Birthdate, Salary, Name First Name, Middle Name, Last Name), Supervisor Id) 11. (a) Minimum number of tables needed is 2.as 1S table have the relation between Mand Pand 25 table as Pand N. Hence option (a) is correct wwrmmadeeasy.in Postal Study Course BTIE] © (0) 14 15. 16. DBMS 6 &) 7 @ 8&8 © 9% (3) 1. User (1D) 2. Account (ID, AID) 3. Items (Item id, ID) ) IE, is merged with F it contains 70% NULL values, IE, Is merged with A it contains 30% NULL. values, Merging which gives less number of Null value is pretfered. E, and E, can't be merged into a single table because £,RE, has NO primary key (50) For relationship set Ac key is same because between E, 10 &,, E, to E and £, to E,there is one to many relationship. indidate and E, candidate Objective Pracc Sets TER Q.14 Given FD= (ABC, CDE, E+ FG, GH. Find which of the following can be a possible deduction trom given functional dependencies, (2) OFG>E (&) ACD 8 () ABD>E (@) None of these Q.2 Consider a relation ‘A. all ofits candidate keys are singletons. If Ais in SNF then Ris (@) BONF (0) NotBCNF 7 (¢) May not be BCNF (8) Information is not sulficient Q.3. Consider R= ABCDEFGH and the following FDS: H>GD E30 HD CE BDA Identify the minimal cover of the given FD's? (@) {HG E50, C, HD, 80> 4} (0) (HG, H>D,E>0,H>C,BD+A) (© 14> G,E>0,H>C,HD+ 6,805) (@) (HG, E40,H>C,H>E,BD 3A) Q4 Consider a relation ALA B CO &) with sets of FDS RA B, BC E, ED» Al Given Riss in which highest normal forms? (@ 1NF (0) 2NF (©) 3NF (6) BCNF Q.5 Let Abe the relational schema with FDs F, is decomposed into R, and A, is loss less join decomposition only it @ @ RUReR () RARee (ii) F,.0 Ry gives candidate key that should be primary key in either Ror A, (0) AUR ER (i) RAR 46 (ii) R,7 Re gives candidate key thet should be primary key in either A, or Ry aca ae Database Design and Normalization (0 RuRAR (i) Rn Reeo (il) B, oR gives candidate koy that should not be primary key in ether FoF Ry OW RUReR (i) Rn Ree (il) B, 9 Gives candidate key that should nat be primary key in either A, oF A Q.6 Consider the relation schema $= {A,B C, D} {and the following functional dependencies on S. A~>8CD BoC CD+A Which of the following is rue? (@) Sisin SNF and also in BCNF (©) Sisin 3NF but not in BONF () Sisin 2.NF but not in 3NF (@) Sis in BONF but not in3 NF Q.7-Arelation A with two attribute is always in (a) 1NF (b) 2NE (c) 3NF (d) BCNF Q.8 Consider the universal relation A= (A, B, C, D, EF. G,H,1, Jjand the setof FD, F= (AB C, A DEB > F,F-+ GHD iM. Ris decomposed into A=1A8,C,0.6) R=18.6GHI Ry=(01.4 Then the decomposition of Ris (@) Lossiessjoin and dependency preservation (6) Lossy but dependency preservation (© Lossless join but not dependency preservation (@) Lossy and loss of dependency Q.9. Consider the following relation as Vehicle (vehicla No, sold_date, salesmanNo, comrnission%, discount_amt) ‘Assume that a vehicle may be sold by multiple salesman and vehicle {vehicle No, salesmanNo} is Primary key. Additional dependencies are Solc_date — discount_amt and salesmanNo—> commission%. Given relation isin which normal form? (@) INF (b) 2NF (©) 3NF (@) None of these Q.10 Given the relational schema AA, B.C, 0, 2ywith 16 the following functional dependencies. A>B,BD>E,C>AD,E9C Find which of the following is not a candidate key? @e oc (© 8D @aA a7 .11 Find the number of F's inthe minimal cover of following FD set FD = {A-» 8, CD-» A, CBD, CED, AEF, AC» 0} @2 ) 3 oa @5 Q.12 Find the number of possibilities to choose a primary key of the relation UA, 8, C, D, B). @5 &) 35 © 3 (d) 120 a1 Q.13 Let Risa relation schema, A(A, B, C, D) and F= {A= BBC, C— Ajis the set of functional dependency. How many candidate keys are there? @1 ) 2 os (@) None of these Q.14 Suppose we have a relation R (A, 8, C) with multivalued dependency (4 8}. Ifwe know that tuples (a, bt, ct), (a, b2, 02), (a, 62, €3)), (a, 63, c3,) are in A what other tuples do we know must also be in R (@) (2,61, 2), (a, bt, 68), (a, b2, ct (©) (2, bt, 02), (a, b2, ct), (4, b3, ¢' 1), (a, 68, 62) © (a, d1, 02), (a, b1, ©), (a, b2, e1), (a, 63, 1), (a, b3, <2) (@) None of the above a9 (a, 68, MADE Easy wurwamadeeasy.in MADE EASY ERNE 2079] eM | Consider the relation given betow and find the maximum normal form applicable to them 1. AAA, B) with productions (4 — 8) 2. FLA, B) with productions (B—> A) 3. ALA, 8) with productions (A> B, B—> A) 4. AIA, B, Ovwith productions {A+ B, BA, 4B 0) (@) 1,2and 3 are in 3NF and 4 isin BCNF (0) 1.and2 are in BCNF and 3 and 4 are in SNF (©) Allere in 3NF (@) Allarein BONF Consider the relation AVA, B, C, D, E) and the set (AB > CE, E> AB, CD What is the highest normal form ofthis relation? (a) 1NF (b) 2NF (©) SNF (0) BCNF Given the relation AX, ¥, W, Z, P, Q)and the set XY > W, XW > P, PQ Z, XY Qh Consider the decomposition F(Z, P, Q) and R, (X.Y, W, P, Q). This decomposition is {@) Lossless decomposition (0) Lossy decomposition (©) Either lossless or lossy {@) Neither lossless or lossy Consider the relation SCHEDULE shown below. ‘What is the highest normal form of this relation? SCHEDULE (Student_ID, Class_No, Student_Name, Student_Major, Class_Time, Building _Room, instructor), ‘Assiime the following functional dependencies (Student_1D + Student_Name, Student_ID > Student_Major, Class_No — Class_time, Class_No > Building Room, Class_No— Instructor} (@) INF (b) 2NF (©) SNF (d) 8CNF ‘relation Ris defined as A(S#, STATUS, CITY, SNAME) where St is the primary key. If R is decomposed into two relations Rand R, which of the following is a loss less decomposition? (@) R, (St, STATUS), (SH, CITY, SNAME) (0) F,(S#, STATUS), R.(STATUS, CITY, SNAME} Objective Practice Sets | Computer Science & IT (©) Ry(S#, STATUS, CITY), R, (CITY, SNAME) (@) Ry(S#, STATUS, SNAME), R,(CITY, STATUS) Q.20 Consider the relation A(S, 7, U, V) and the set F= (ST, T+ U, Us Vand V 9). Let Ris decomposed into F and R, such that A, 0 R the decomposition is (@) Lossless decomposition (©) Lossy decomposition (©) Dependency preservation (@) Cannotsay Q.21 Suppose that we decompose the schema F(A, B,C, D, B)into RA, B, C) and RA, D, E) ifthe set Fare functional dependencies holds on R. F= {A 8C, CDE, BD, EA} The decomposition is a (@) Lossiess decomposition (©) Lossy decomposition (c) May or may not be lossless decomposition (@) None of these Q.22 Find the highest normal form ofthe relation ACA, B,C, D) and the set = {AB D, AC BD, B> C} (@) INE (o) 2NF (©) one (0) BCNF Q.23 Consider the following set of functional dependencies (FDs) {Emp_No—Ename, Bdate, Address, Dept No} {DepiLNo— Dneme, Mgr No} ‘The additional FOXs) which cannot be inferred from the above set of FDs is (@)_{Emp_No—» Dname, Mgr No} (b) (Ename -» Dept_No} (©) (Emp_No—»Dnama} (@) (Ename, Dept No-+Mgr_No} Q.24 A relation ({rom the relational database model) consists of a set of tuples, which implies that {@) all tuples in a relation must be cistinet (b) relational model supports multi-valued attributes whose values can be represented in sets (©) for any two tuples, the values associated with al oftheir attributes may be the same (@) all tupies in a particular relation may have different attributes (AJ ovjective Practice Sets Postal Study Course EDIE] Oa MApeE EAs 0.25 if Kis a foreign key in relation A, then (@) Every tuple of Rt has a distin value for K (b) K cannot have a null value fr tuples in At (c) Kis a key for some other relation (@) Kis a primary key for Pt Q.26 If WX, Yand Zare attributes of a relation, which of the following inference rules for functional dependencies is correct? @) it Yo Xthen YX (0) IX Ythen (%, 2) 90%, (©) XY, then X ¥ (@) If (X 2) Vthen X Yand Z> ¥ .27 Consider relation schema FLA, B, C, D, E) with functional dependencies Fcontaining A» Band CD. The schema is decomposed into F(A, B) and A, (A, CO, €). Find which relation is not in BON. (@) A, is notin 8CNF (0) Risnotin BCNF (©) A, is not in BCNF but A, is in BCNF (@) None of these Q.28 Let R(ABCDEFGH) be a relation withthe following functional dependencies FD = (AB COEF AvC B30 C3 FG GoH HF G>A Find the maximum normal form applicable to R. (@y NF (0) 2NF (© SNF (@) BONF .29 Consider the following functional dependencies ina database Date of Bith > Age Age = Eligibility Name» Roll number Rollnumber > Name Course_number > course_name Course_numer—> instructor (RolLnumber, Course_number) —> Grade ‘The relation (Roll number, Name, date of birth Age) is wwwmadeeasy.in MADE ERSY (@) in 2NF but not in 3 NF (©) in 3NF butt in BCNF (©) inBONF (d) None of the above @.30 Consider the following instance x Y Zz 1 4 2 1 5 3 1 6 3 3 2 2 Which one of the following correctly describe the ‘functional dependency hold by above instance. (@) XY ZandZ3Y (0) YZ4X, ¥ Zand YX (co) YZ Xand XZ (0) XY Vand XZ Q.31 Consider the following set of functional dependencies Fon the schema (A, B, C) F(A 80,80, A+B, ABO) The canonical cover of his sets (@) A+ 8Cand BC (0) A> 8Cand ABC (0) A BCand A> 8 (@ As BandB>C Q.32 f= (A> 8C,B+A,C>A} 9=(A>B.B>2C,C3A} (@) fovers g (b) gooversf (©) Fand gare equivatent (d) none of these Q.39 Given a relation AAA, B, C, D, E) with functional dependencies A> B, B-> Cand BD > €. Which one of the following could be result of decomposition of into BCNF? (a) AB, BC,BDE —(b) AD, BDE, ABC (©) ABD, BE,CE — () AB, ACD, BCE Q.34 Consider the relation RA, 8, C, D, ©) with Pein 2073] Dens | \Wrich must necessarily hold in RP (@) only (0) 2only (ce) 2and3 (a) 1,2and3. Q.35 Crsider the relation schema S{A, 8, C, 0) and the following functional dependencies on S{A+ BCD, B+ 0, CDA} It we decompose Sinto S, = ABDand S, = BC, then fil in the following blanks for A, Band C 1. The decomposition is 2. The decomposition is 3. Valid decomposition into {@) lossiess, dependency preserving, BCNF (0) lossless, nat dependency preserving, BCNE (©) lossy, not dependency preserving, SNF (@) lossy, dependency preserving, BENE Q.36 Consider the following table: a 3 c * ¥ Zz m a n A m z ° Pp Pp q q q x Zz a Which of the following dependencies holds true for the atiove table? (a) AB>C (©) Both (a) and(b) Q.37 In the relation AA, 8, C, D) with functional dependencies F = (AB > CD, C+ A, D> B) How many number of candidate keys are there forthe above relation? (a) 2 4 (b) BOA (@) None of these (b) 3 (@) None of these Q.38 Consider the following relation and its sample data, (Consider that these are the only tuples for the given relation)? dependencies A > + BC and D+ Bof the [i Dept No [Prono folowing dependencies I or) 2 1 AaB oF 2, A+aC o1 12 ee ee 01 4 | vom madeeasy.n GaMAdE Ens Objective Practice Ste Objective Practice Sets | Computer Science & IT 1, The functional dependency (Emp No, Dept No}-+ ProjNo holds over F, 2. The functional dependency DeptNo—> ProjNo holds over R, 3. The functional dependency EmpNo —> DepiNo holds over A 4. The functional dependency Proj No —> DeptNo holds over F. 5. The functional dependency (EmpNo, ProjNo) = DeptNo holds over A. (@) 1,2and3 (©) 2,3and4 (©) 3,4and5 (@) Allof these Q.39 Consider the relation Properly (Provertyld Vilage name, Lot# Area)’ with the following functional dependencios. 1. Propertyid —>(VillageName, Lott, Area) 2, (VillageName, Lot#) > (Propertyid, Area) 3. Area VillageName Which one of the following statements is false with respect to the information given above? (@) The relation ‘Property isin 3NF. (b) The functional dependency Area —> Village Name violates BCNF. (©) The relation Property’is in BCNF. (6) All of the above. Q.40 The terms in List-1 have been mapped to List-lI 0 that it corresponds to the mapping process of the ER Model into a Relational model. Which ofthe following represents the mapping process? List Entity type Key attributes Composite attribute Mutivalued attribute Value set List Primary or (Secondary) Key Domain Relation and Foreign key Set of simple component attributes Relation moom> opens Postal Study Course PLIE]| at G3 mMApE Easy Codes: A BC DE @ 3 1 4 2 5 ®) 5 1 4 3 2 © 3 1 4 5 2 @ 5 1 8 4 2 Consider the following statements. 1. An entity integrity constraint states that no primary key value can be null A referential integrity constraint is specified between two relations, 3. A foreign key cannot be used to refer toits own relation, Identity which of the above statements are correct, (@) Only tand3 (©) Only tand 2 (b) Only 2and3 (@) Allof these Q.42 Which of the following statements is not correct a3 with respect to normalization? (@) Normalization is a formal technique that can be used at any stage of the database design. (©) Normalization can be used as a validation technique to check the structure of relations which may have been created using ER modeling, (0) The process of normalization through decomposition mustachieve the lossless join property at any cost whereas the dependency preservation property is sometimes sacrificed, (2) None of the above Choose the correct statements. (a) An alternate key is a candidate key that is nota primary key (0) An alternate key is a primary key that is not acandidate key (c) An alternate key is a candidate key that is also a primary key (d) None of the above Q.44 Third normal form is inadequate in situations (9 MADE EASY where the relation ‘wuremadeeasy.in MADE EASY (@) has multiple candidate keys (0) has candidate keys that are composite (©) has overlapped candidate keys (8) Allof the above Q.45 Redundancy is dangerous as it is a potential threat to data (@) integrity (©) sufficiency (0) consistency (@) both (a)and(b) Q.46 For relation FLA, B,C, D, E, F) the set of FDS is (A> C850, C+E DFE, E54 FB What is the candidate key for R @aA ) c jo (a) F Q.47 Let Ra, b, o) and S(d, ¢, be two relations in which dis the foreign key of $ that refers to the primary key of R, Consider the following four operations Rand S 1. Insert into R 2. Insert into S 8. DeletefromR 4. ‘Delete from Which ofthe following is true about the referential integrity constraint above? (@) None of 1, 2, 8 0r4 can cause its violation (0) All of 1, 2,3 and 4 can cause its violation (©) Both 1 and 4 can cause its violation (@) Both 2 and 3 can cause its violation Q.48 Asst of FDs is given for a relation (A,B, C, D, EFG) (AB, BC DE, AEF G) What is the closure of {4, C}* under this set? @ ABC () A.B.0,0 MABCOEF (W) ABCDE Q.49 Which the relation R with four attributes A, B, C and D the functional dependencies ((A, 8) > (C, Dana C30) Which of the following statements isfare correct?” (a) Cis key for elation R Postal Study Course BXAE] Q.50 Consider two relation schema Ry, = 5) and R, (A, B, ©, D, B), Statement 1 is the function dependency of A and2is the functional dependency of Fi, 1. A+B, AB C,D-+ AC, DE 2. ABO, DAE Which ofthe following statements tue? (@) Functional dependency of is equivalent to functional dependency of F (©) Functional dependency of R, and A, are not equivalent (6) Wecarit compare functional dependency of R, end R, (0) None of the above Q.51 For the given relation instance the best normal fornis allele le oT TF (a) NF (b) 2NF (c) SNF (@) BCNF Q.52 Consider a schema (A, B, C, D) and functional dependencies: A B and C-» D. Then the decomposton of Pinto A, (AB) and R (CD) is (@) dependency preserving and lossless jin (0) ‘ossless on but not dependency preserving (6) dependency preserding but notlossessjon (@) not dependency presoring and ntlossess ion 2.53 Let A be a relation. Which of the following comments about the relation Rare correct? 1. Rill necessarily have a composite key if F is in BONF but not in 4NF 2. If Risin 3NF and it every key of Ais simple, then Ris in BCNF 8. If Ris in BONF and if Phas at least one simple key, then Ais in 4NF 4, I Risin NF and if its every key is simple, (0) Risin NF singh (©) Functional dependency C-» Dviolates 3 NF. then Ris in SNF {d) Ris in BCNF. {a) tand4 (b) 2and3 () 1,2and3 @) 1,2,3and4 wrmadecasyin GEMBBE EASE ——— Objective Practice sets | Computer Science & IT Q.54 Match List- with List-l and select the correct answer using the codes given below the lists: List-1 ae CED Gm 3 GamaS ema © @ceaes) emis List-tI Transitive dependencies. 2. Trivial dependencies, 3. Partial dependencies, Codes: Ae Bc (dee ® 1 3 4 lei 2 @ 3 2 1 EEEEIIEN Database Design and Normalization O22 M4 O&O 10. (a) 11. (gd) 12. (6) 13. () 14 (© 19, (a) 20. (b) 21. (a) 22, (©) 23. (b) 28. (a) 29. (d) 30. (b) 31. (@) 32. () 37. (c) 38. (c) 39. (c) 40. (b) 41. () 46. () 47. () 48. () 49. () 50. {a 55. (d) FEBEEIIEI ostatese Design and Normalization ©) 2 Abc Agent ABD» CD and we have CD E, Transitively : ABD Esa possible deduction. OR (ABD)* = ABCOEFGH ABD E's possible is} Objective Practice Sets Postal Study Course FUE fa maoce Easy fa made EASY Q.55 From the following instance of a elation schema (A, B, C}, we can conclude that: A[BIC] (@ A tunctionally determines 8 and 8 functionally determines C (b) A functionally determines Band Bdoes not functionally determine (©) Adoes not functionally determine C (0) Allof the above are correct ~ —_ ee Ce) ee) 18. (d) “16. (0) 17. @ 18. @ 24. (2) 25. (©) 26. ) 27. &) 33. (a) 34. (b) 35. (&) 36. ( 42, (d) 43. (@) 44. (d) 45. (@) 51. @ 52 () 83. d) 54. () (a) Given Ris in 3NF, Either FD LHS is key or FHS is prime attributes. IF LHS FDis a key then itis BCNF If HS FDis prime attribute then it must be key, because all candidate keys are singleton. So itis also in BCNF. Riis also in BCNF MADE EASY 3. (d) Given FDs: H> @D EsD HD CE BDA (1) Right reduced FDs. HoG H>D E30 HDC HOE BDA (2) Loftreduced FDs HG H3+D E+D H>c HE BDA (3) Minimal cover: H3G E+D H3c HE BDA F. a (AB, BCE, ED-+ A) AB, (80) = BCE (6D = EDAB So candidate keys may be {EDC, BCD, ACD} and prime attributes are (4, B, C, 0, E} BNF: If x ythen x should be candidate key hen the relation will be in BCNF. In the given FDs sot (A B, BO E, ED A), x may be A of Cor ED which ate not candidate key so given relation is not in BCNF, SNF: If x—> ythen (i) x should be candidate key, oF (i) ¥ should be prime attribute in our given relation y may be B, E, A, which are prime attributes. So given relation is in $ NF. Postal Study Course BTJE| Dams | i 6. (b) (A= BCD, B+ 0, CD-» A} ABCD CO = ABCD So candidate keys aro (4, CD} Prime attributes are (A, C,D} Check for BCNF : A= BODY (- Ais candidate key) B+ OX(-s Bis not candidate key) CD AY (CDis candidate key) Check for 3NF : A= BODY (:. Ais candidate key) B- Cv (-- Cis prime attibute) CD AY (-2 CDis candidate key) 7. (d) Let the relation is AVA, B) if Ais key then A Bich isin BCNF if Bis key then 8» A which is also in BCNF if ABis key then AB AB which is in BCNF 80 F(A, 8) will always in BCNF 8. (a) Fe (AB C,A DE BF, F»GH, D>) (AB) = (ABCOEFGHI J 80 AB is candidate key R(ABCOEFGHIJ) Vi R(ABCDE) RABFOG) ALOT) [Common attribute between R, and R, is 8] B=B.FGH so B is key in Re Ry (ABCDEFGH) \ Da yO.1.4) (Common attribute between R, and Re, is D| D. and DY = D1. so Disc. key in SORA BCDEFGHIY The this decomposition is toss less decomposition. Objective Practice Sets 40. 1" 12, 13, 14, Objective Practice Sets | Computer Science & IT Check for dependency preservation R(ABCDEFGHIJ) R(ABCOE | AZADE a=B (AB) =A.B.0,0,E R,(BF, GH) B=BAGH F; » FGH} kG H ae R(D.1.G) D=D1,G ee FURR Mee oS F S0F,UF,U Fis equivalent to F 0 dependency is preserved (a) In the given relation salesman No. has multiple aitrioute so itis not in 4NF. (a) 16, (© = ECADB= ABCDE 16. (Oy = ABODE (BD) = ABCDE (A)* can not determine al tributes, :. Ais nota candidate key. (a) AC + D can be eliminated, it can be derived from A> B and CB -+ Dusing augmentation and transite rue 7 A+B AC>8C = ACD and emaining FD are not possible to eliminate. 5 FDS are therein the minimal cover. (c) Number of possible primary keys are 25~1 = 31 (with zero attributes not possible) (c) ‘The candidate keys are AD, BD and CO. (co) Ifthe MD A+ Bholds,then the MDAC gy also holds. Notice that all the A values are the 18. 19, Postal Study Course EXIE| (§ MADE Ensy 03 MADE ERSY We are given a ®, ¢ a & & a 2 q a ° & Since there are three B values, and tree Cyvalues (further sare A), we can confidently state that thete willbe nine combinations, The question only lists four, we can thus state the following five tuples, a a G a b, CG a b, G a , G a , G () Consider the relations 1, 2 and 3. Allare binary relations. A binary relation always be in BCNF. Coming to 4th relation tis also in BCNF because A, Band AB all are super keys. (b) ‘Two possible keys of the relation are AB and E. Therefore prime attributes are, A, Band E, Non prime atirivutes are Cand D. The relation is in 2NF because there are no partial dependency (on any of the key. ‘The relation is not in NF because of C+D ‘functional dependency, (a) RRR, ie. (ZPQ) m (XYWPQ) = PQand POs Primary key of R, (a) There are some partial dependences on the key, for example, Class_No — Building Room or Student_ID + Student_Major. Therefore the highest normal form of the above relation is 1 (a) FoR, = Si which is primary key in R, (a) R, 0 R, > R12, (ABQ) 0 (ADE) = Aand Als Primary key in R, wwmmadeeasy.in G3 MADE EAs! so Eee 2078] 22, 23. a7. 28. 29. 30. ©) 3 The key ofthis elation are ABand AC. The prime attributes are {A, B,C) $o, the relations in 3NF. (©) {Emp_No]* = (Ename, Bdate, Address, Dept No, Dname, Mgt_No} {Ename, Dept.No}* = (Ename, Dname, Mgt_No} (Ename}* = [Ename} (b) RIA, B, C, D) is decomposed into R, (A.B) with FD = {A+ Bh and R,(A, C, D, ) with FD = {CD} For Ri: Ais superkey so R, is in BCNF For R, Cis nota superkey. Hence fi is notin BCNF (a) The primary key of relation is AB. And there exist partial dependencies A C, 8 + D. Hence Relation is notin 2NF. (0) For this relation, only following FDs are of consideration 4, Date of Bith + Age 2, Name — Roll_number 8, Roll_number—> Name Keys of relation are (name, Date of Birth) and. (Roll_number, Date of Birth) The relation is not in 2NF because of partial dependency ie, Date of Birth -» Age. The other two FDs ze not partial bacause their righthand side attributes are prime attributes, (b) YZ Xis true because YZ is not repeating gp anywhere. If YZ repeats then X has to be repeated, 2» Vis false because in first tuple when value of Zis 2, then value of Yis 4, but in last tuple value of ¥has to be 4 but itis 2, Similarly is the care with 2nd and 3rd tuple. (3 MADE ERs Dems | (a) [ABC Bac Ord set 185 ABC Now check extraneous in L.H.S. Take B as extraneous attribute (ABC BoC A+B Asc Now old FD's imply the new FDs So B is an extraneous attribute. Similarly if we check for ©, it is also an extraneous attribute. But we will remove only one attribute to preserve the dependency in the set. Now the reduced FD's willbe A>BC B20 A+B | New set Ate But the last two dependencies can be removed because they can be derived from A> BC. Now, the FO set will be ABC] eae | now we check extraneous attribute in RLH.S. Take Casextraneous ABI eae here new set of FD’s implies old set of FD's. So Cis an extraneous attribute. Similarly Bis not an extraneous attribute. (ce) {A> BC, B4A,C3 A) g=1A>B,8B90,C3A) To check if f covers g, every FD in g logically implies in f FDing:A+B,B+C,C3A Check for A B, Ae > ABCA BC in f) Check for BC, Objective Precce sets 33, 36. 36. 37. 38. 39, is} | Computer Science & IT BY > BAC, (B+ A. A>BCin Check for 6 A, C'> CABIC>A, A> BCin Therefore, Feovers 9. To check if g covers FDinf: A> BC, BA CA Check for A 80, At > ABC (AB, B Cin gh Check for BA B+ BCA(B > 0, C>Aingh Check tor CA OS A(C> Ain gh Therefore, g covers f. Both f and g covers each other, so they are equivalent (a) All the FDs violate BONF, so create a separate relation for each functional dependency. 47, (b) 48. 1, $, 9S, = Bhere BC. Solostless 2. CD Aand A-> Care lost. 3. Since FD B -» Ccause problem for BCNF Soiitis BCNF decomposition (c) For each combination of attributes on LHS, there should be a unique combination on RHS. It states true for both (a) and (b) (c) There are four keys AB, CD, AD, 8C [4B = [ABCD [CDF = {4BCD, {AD}? = {ABCD} \6C}" = {ABCD (c) * ‘The FD (EmpNo, DeptNo.) > ProjNo does not hold because for EmpNo 1001 and DeptNo of there are two ProjNo (12,18), which violates the PD. Similarly FD DeptNo ~+ ProjNo vilotes the FD. (c) The ‘Property’ Relation is not in BCNF bacause the FD Area — VillageName Vilotes BCNF. (Objective Practice Sets Postal Study Course LIE] 49. (made Easy G3 MADE EASY @) Referential integrity constraint In relational model, two relation are related to each other over the basis of attributes. Every value of referencing attribute must be null or be available in the referenced attribute. RQ, b,c) and S(d, 0, here dis the foreign key of S that refers to the primary key of F 41. Insert into F will not cause any vollation, 2. Insert into S may cause violation because for each entry in 'S" it must be in F. 3. Delete from Amay cause violation because for the deleted entry in R there may be referenced entry in the relation S, 4, Delete from Swill not cause any violation. Hence (d) is the correct option, (a) PIA, B, C,D,E,F,G) ASA B BC DE :(AO)}* = (A, B, ©, D, E Hence (d) isthe correct option (c) (A, B)>(C, Dyand C> 0} for (A, 8) +(C, D) The candidate key is AB also if C > Die. non key going for non-key hence Cis neither a key and Dis not a prime attribute hence C— Dviolating 3NF condition. Hence (c) is correct option, (a) R,=(4.8,0,0,6) A~> BAB C,D-> AC, DE A, 8,00.) A= BO, D> AE Here candidate key of relation A, is AD" = (A, B,C, D, 8) FDSsetis = {A B, ABC, A+, D> AC, D+A,D9C,0>8 For relation Ri, candidate key is AD wwaw.madeeasy.in (2 MaDe EASY PD's setis=(A+B,A>C.A%BCD+A, 56. D+0,0-+E,D+AC} ‘As we can see cleary Hence option (a) is correct, Fi 51. (a) For the given relation instance we have the FD sot as AB>C AaD Boer Hence candidate is AB For ABC inBCNE AD in tNF (Partial dependency) NF B->EF in NF (Partial dependency) in BCNF| Hence (a)is the correct option 52. (c) AB), Re{CD) for PLA, B,C, D) For losssless join, 3 conditions must hold by relations R, and R, () UR ABUCD=ABCD=R True @ False So, not lossless join For dependency preserving, in RAB) As B At = AB Acandidate key for A, inR(CD) C40 Ct = CD Candidate key for F So, the decompositions dependency preserved but not lossless. QampdE Easy www.madeeasy.in Postal Study Course BYE] Dems | (a) From the given instance we can determine that when A=t Bat Az2 B=3| Hence A functionally determines 8. when B=1 C=1 c=0 B=3 C=2 Hence Bdoes not functionally determining C. Objective Practice Sets [ety 3 CHAPTER Qt a2 as a4 Which of the following relational algebraic operation is not a commutative operation? (@) Union (6) Intersection (©) Selection (A) Projection Consider a banking database withthe folowing table with three attributes loans (br_name, loan_no, amount) Find the appropriate query for the given statements below. Find the loan number for each loan of an amount ‘greater than 20000" {@) {t]te loans » famount] > 20000} where isa tuple (©) {t] 3 Se loans (flloan_no] = Sfloan_no} ‘s [amount] > 20000} (0) [t] se loans (floan_no} = Stloan_no} ‘s[amount] > 20000} (6) None of the above Which ofthe following is wrong? @ Myvry (E,PSyED) = (My (E)) PAY (ED) (0) op(E- Ep) =09(E;)- E> (©) 5,09 (E) = Fo, (9 (ED) @) E,P, E= EPS, E Information about a collection of students is Given by the relation studinfo (studi, name, sex). The relation enroll (studid. Courseld) gives which student has enrolled for (or taken) what course). ‘Assume that every course is taken by at least cone male and atleast one female student. What does the following relational algebra expression represent? Rouse (Meat Ssex= temas’ (Studinfo)) x n, (enrol))— enrol) (@) Courses in which all he female students are enrolled (©) Courses in which a proper subset of female students are enrolled cures as as a7 Relational Algebra (€) Courses in which only male students are enrolled (d) None of the above Select the relational expression which could possibly return the following result ale] 7[2] 2/3 @) 11, (0,20) © 0, (©) Mot, 9) (9) 9,26 (Ma oF) Consider a following declaration eran nae (Bane =-ouaar (OFANCH)) smo, tvancs nae (depositor P< account) wae (ranch) ) *yancn nara (rah Consider the folowing relation schemas: b-Schema = (b-name, b-city, assets) a-Schema = (a-num, b-name, bal) Schema =(cname, anumber) Let branch, account depositor be respectively instance of the above schemas. Assume that account and depostor relations are much bigger than the branch relation Consider the following query a (ecays ea ava eo (0F@NCH De (account al depositor) G3MADE EASY Which one of the following queries is the most efficient version of the above query? 8) Me rame(Sou) <0 (Spey « raga: BfaNCh Dt account Pd depositor) (©) Menus (Sty « agar BEBMCHES (ty account P< depositor)) ©) Tesana (enya aga BFANCHPS O,, sua 20 2000unt 2 depositor) (©) Thane (Opeyaage BACH Pt Oey ag aval <9 @cOUNt DC depositor) ‘aret eS eie ar Q.8 Which of the foliowing relational query language have the same expressive powor? 1. Relational Algebra, 2. Tuple relational calculus restricted to safe expression, 3. Domain relational calculus restricted to safe expression as (@) 2and3ony (6) 1 andZonly (©) tand3ony —(@) 1, 2and3 Q9 IP and Qare predicates and e is the relational algebra expression, then which ofthe following equivalence is valid? (@) 6,(69(€)) = 09/0, (€)) (©) 65(09(€))= 5 ng(€) an © 95 (65 (€))=o..g(€) (@) Allofthe above Q.10 Which of the following sets of operations Tepresent a complete set of relational algebra operations? @) (68,.U-X) 0) [6,,u,=,x} ©) [6.0-X) @) 18,U.654) Q.11 Consider the given schema Client (customer-name, banker-name) (Customer (customer-name, street, customer-city) Which of the folowing queries finds the clients of 15 banker Atul and the city they live in? (2) Noten.casomsr-aecuscerciy (Ooien caterer came += Customer ctorersiame Faarker name = “aur (Client xCustomer))) (©) Meusiomername customer Tpante-name = “Aut (Client x Customer}) wwwimadeeasy.in G3 MADE EASY Dems | (©) Mesercusomertane,cuscrnacy(Soartarcame At! (Caer cusemesaane = ustomercusonernene( Client xCustomer)) (8) Tso name, evtamerciy(Tbankerrae = "A (Client x Customer) Translate the following tuple relational calculus expression into English language. (113 Se student (t[S, name}) = ${S. name] 3 We course (u [S. no] = $ [S. no} 4 u [course cs"I}} (a) Select all tuples of student name (©) Select all tuples of student name studying CS" course (¢) Set of all tuples of students name with same ‘course number and student number who are studying “CS” course (6) None of these ‘The relational algebra expression equivalent to the following tuple calculate expression: (ther (A} = 104 ¢[8] = 20))is @ Oa-rovecee) (0 ©) O44 10) (NUG 0.250 ©) 4210). Go.20,(0 (9 40 10)- Sen29(0 Given the relations Employee (name, salary, deptno) and Department (deptno, depiname, address) which of the following queries cannot be expressed using the basic relational algebra ‘operation (6, m, x.><, U, 0, -)? (@) Department address of every employes (0) Employees whose name is the same as their department name (©) The sum of all employees salaries (@) Allthe employees of a given department Consider the database having the following relations: Products (pid, pname, city-quantity, price) Customers (cid, cname, city, discount) Agents(aid, aname, city, percent) Orders(orderno, month, cid, aid, pid, gty, dollors) Objective Practice Sets is} | Computer Science & IT PSSEM201] G3MADE EASY Which of the following returns “the customers \who place order only through agent a,"? ©) Byeme (Customers Dt (raig(Customers) Ru Sug = Ae(Orders))) (©) epgne(Customers P< (r,j,(Customers)- Rails 2(Orders))) (©) Repl Oder8) Reef Gait Orders) (@) None of the above Q.16 What does the following query do {S.rolINo, S. name | student (S) S.sex = 'F" (Zo) (department (a) * d. name = ‘Maths’ 4 a, deptid = S, deptNo)} (@) Name of all students in Maths dept (©) Obtain the rollNo, name of all gil students in the Maths Dept. (¢) Obtain the name of all male students in the Maths Dept. (@) None of the above Q.17 Let A(A. 8. C) and RAB, 6) be two relation schema, where the primary keys are shown underined, and let C be a foreign key in R, referring R. Suppose there is no violation of the above referential integrity constraint in the corresponding relational instances r, and rp Which one of the following relational algebra expressions would necessarily produce an emply relation? (@) mft,)—mel") (0) lr) Apt) (©) mApaceo’ (Td oaceo') Q.18 The following query in TRC solects: {[S. name | student (S) © (Be) (31) (enrotiment (6) ‘teaching (1) ® @. courseld = t. coursald * @ TOlINO = S. roINO A t. empld = S. advisor} (@) Students who have taken all courses taught by their advisor. (©) Students who have taken courses, not taught by their advisor. (6) Students who have taken atleast one course taught by their advisor. (@) None of the above. Q.19 Consider the following database scheme book (ace-no. yr-pub, ttle) Q.20 ser (card.no, b-name, b-address) supplier (name, s-adder) borrow(aca:no, card-no, doi) Supp (acc:no, s-name, price, dos) \Whatthe folowing retaional calculus represents? {{IBue user (¢[b-name] = ulb-namel se borrow u(card-no] = bfcard-no|a (Ase supp(sface-no] = blace-no]a s{s-name] = "narosa’)), 1 qe supp(aface-no s-name] = "alied”))) (2) Find all borrows who have issued a book supplied by “narosa” but have not issued any book supplied by “allied” (b) Find all borrowers who have issued a book supplied by both ‘narosa" and allied (©) Find al borrowers who have issued a book supplied by ‘lied’ but not by ‘narosa’ (d) Find atleast one borrower who have issued 2 book suppliedby “narosa" but have not issued any book supplied by “allied” bface-no|a Consider the sequence of operations given below ‘on the relation Employee (EmpNo, Name, Address, Bdate, Gender, Salary, SupetNo, DNo) 1. DEP5_EMPS « (6DNo = 5)Employee)) 2. RESULT! < nEmpNo(OEPS_EMPS) 3. RESULT2{EmpNo} — ‘xSuperNo(DEPS_EMPS) 4, RESULT — RESULT! URESULT2 What will the above sequence of operations performed on the given relation produce? (2) EmpNo of the DNo 5 who work either as an employee ora supervisor. (b) EmpNoof the employees who work in DNoS: along with the employees of DNo 5 who work as supervisors. (¢)_ Emp Noof the DNo 5 employees who work as supervisor, (@) EmpNo of the employees who either work in DNo5 or supervise an employee who works inDNoS (EJ objective Practice Sets Gg MADE Ensy TRACE MADE EASY Q.21 Consider the relations Branch(BranchNo, Street, City) and Property(PropertyNo, Address, City). Whieh of the following relational algebra expression would is all cities where theres both abranch office and at least one property? @) Moyy(Branch) U Re,,(Property) (0) toy (Branch) ~no, (Property) (©) Mo4y(Branch) + no,,(Property) (0) Reay(Branch) -(Roy(Branch)—Roy(Property) .22 Assume table A has two altributes A and 8. Similarly table S has two attributes A and 8. Which of the following relational algebra expressions are not equivalont to Rn $? (@) Roas (0) (RUS)-(R-H)U(S-A) (ce) S-(S-R) (d) R-(S-A) Q.23 Find the number of tuples returned by the following query? [p is used to rename] Ry (RX S)~ Pas (an (APS Bec S)) (4 5 os 7 Q.24 Member (Mid, Name, Designation, Age) Books (Bid, Bitte, Bauthor, Bprice) Reserves (Mid, Bid, Date) Which of the following option will retrieve the titles of books reserved by lecturers? (2) Tyaraeniel(MEMbEF Dd ijentcid «reser Mid) AND (Oavgaton = acer) PESENVE) Pdhags secxs 942 00K8) {) Thee inl (MEMBEt tenes Mi) AND {Designation « Lecurer) RESENE) Presets cots 82800KS) (©) Taner (MEMbE Dd embers ear Mi) ‘x0 Don gpaten tener RESENVE) Paes ecrnae Beaks g200KS) (d) None ofthese Postal Study Course EEAE]| (mabe Easy Dems | 0.25 Let FRand Se two relations withthe following schema AP QR, A.A) SEQS,S,) Where (P, Q} is the key for both schemas. Which ofthe following queries are equivalent? |. TI,(AbaS) H. T1,(R) Da T1,(S) ML. Tp (MI, 9() 0p 0S) NM. Tp(Op 9()-(Mp (A) Ha o(S))) (a) Only! andi {b) Only tand tl (c) Only, Wand Il (d) Only 1, Ill and Iv .26 Consider the following relations RYABQ\end R, (ADE) RR, has 1000 records and A, has 2000 records. The non-Null attribute ‘A’ in A is referencing aitribute ‘A’ in R,, Let Xbe minimum number of recordsin R,<1A, and Ybe the maxirrum number of records in A,oaR,. The sum of (X+¥) is, Q.27 Considera join elation alzebra) between relation 1(R) with ‘r’ blocks with each block contain ‘A, records and s(5) with ‘m’ blocks with each block contain ‘A, records using block nested loop over nested loop join fat any time oniy 2 block present in main memory. Which of the following is true? {@) If 4A) is outer loop then access cost is (b) If (A) is outer loop then access cost is m+R,x0. (©) If 5{S) is outer loop then access cost is ne Rx. {d) None of the above Q.28 Consider the relations P(a, 8) and Q\A, 8) where Phas foreign key referencing Qvia Band has foreign key referencing Pvia A, Wnich of the following is guaranteed to produce fewer than or at most the same number of tuples as any of the other tables? (@) PDs xg(Q) (@ Pea (0) x,(P) >< (d) None of these Objective Practice Sets Q.29 Consider the following relations R and S | Computer Science & IT a s Aele] [BleTo 72/3] [2;s|o afs|a] j2|afar el7\e} je)7|r2 zislo| [lal ‘The number of tuples in XC S [right outer join] are 0.30 Consider selection query: oy (A) where ast is a relation with 400 tuples. Assume that the altribute values (integers) for A among the tuples are uniformly distributed in the interval [1, 25] How many tuples would the given selection query retums? Consider the following relation schema: Student (Sid, Same) Course (Cid, Cname, Dname) Takes (Sid, Cid, Dame) Find the name of all the students who have taken all the course of the department CS” Which ofthe following will represents the above query? (@) {tl3r © Student (r [Sid]=fSic]) « (Yue Course (ufDname]="CS* = 3se Takes (t [Sid] = s{Sid] » s{cia] = Ucid))} (©) (t13r € Student (r [Sid)=f{Sid)) » (Yue Course («fOname] # “CS v 35 € Takes (t [Sid] = s{Sid] s{cia] = fcid))} (©) Both (a) and (b) (@) None of the above GREEN Felational algebra 1 (G2) ee) aC) Oe (0) Cl) whe C) 3) Eh) 2h) 20. (d) 21. (d) 22. (0) 23. | 32. Postal Study Course EXEE]| Q.82 Consider two relations A(A,, Ay, Ay famAave ensy Aq) and S(Ay, Ay, Ay, -, Ay) where m > n. Find the number of attributes that appears in / S. » [Fl () m+n Q.33 Assume ALA, 8) and S(C, D) relations have the following instances RATS] sfepo itz] [rye 2tr] [ste] sts) [srs Find numberof tuples returned by the following query (ris used to rename the attribute) Rio(AXS)- Pee (a0 (F >a.c §)} Q.34 Consider the relation P(A, B,C), AIC, D, Band (E, F) having tuples 200, 00 and 100 respectively. Estimate the number of tuples in relation Pd Q ba R, Q.35 Consider two relations enrolled and course as shown below Seca ree | | od Des scr] [er cs scm || ce os avian || cs sc a || me Tejas (EMOMEA) ig (Opypre ex (COUSE)) If above relational algebra query executes over above data base table, then how many tuples are there in the result of query? . 6 @ 7 ) 8 ® ® 18. (c) 16. (©) 17. &) 18. () 24. (@ 25. (©) 27. (@) 28. ©) Gamace ensy G3 MADE EASY nal Algebra 2. (b) of an amount greater than 200 clearly, (b) [| 3 s € loans (t [loan_no.] = aoe eeeear 3. (d) E,ea, E, = Ee ,,E; [8 not equivalent because 8 join is not commulative. Hence the entries in E,>2, &, and E,>« ,E,may not be same. 4. (@) Stud Info(stud Id, name, sex) Enrol (Stud id. course Id) The telaional algebra expression Fecueil Rast rxe era SUA INO) X Ranges ferro) — enrol) represents courses in which a proper subset of female students are enrolled Hence, option (d) is correct. 5. (d) ale] 712] l2ia, As we can see clearly both entries of (a < c). ‘also for selecting the enties we have to project on. Hence (d) 6, . ,(T,, Ais the correct option 7. () Branch: (b_name, b city, assets) Account: (a.num, b.name, bal) depositor: (¢.name, 2_number) He rarele, tye nga nat < depositor)}) (2) M name(Goaico(Se, iy = Agr BraNCH >< account >= depositor) wuw.madeeasy.in Postal Study Course PURE 10, " 12. 13. 14, G3 mabe EASY Dems | This join candition will increase the number of results / tuples and at the end, condition is applied which is inefficient. (©) Me pare(o.crye ng BTANCH ba (Gy —gACOOUN a depositor)) cy «ages BFANCh gives the tuples with b_city = "Agra (2) Syg.o8CCOUNt a depositor finds those aco_num balance less than 0 () The join of (1) and (2) gives less number of tuples comparatively option (c) and (a) will also give more number of tuples because of the join conditions and the join operations of tables. So, option (b) is correct. ) Allofthe above are valid the conditions basically are evaluating Pa Q. (a) (0.x, U,-,X} these contribute a complete set of relational algebra operation, (@) Srpeter arama (Client x Customer) (1) It finds the combinations of all clients and customer whose banker name is Atul suslome_ pare = Custamar cinta rame( (1) finds those tuples where both tables have same customer name with banker_name as Alul and finaly, the r conditions retrieves their names. arid customer-city of clients of banker ‘Au. (b) The tuple relationa calculas evaluates all those students having course_name as'CS' (c) Option (c) is valid as it calculates the intersection of different tables having A = 10 and 8 = 20 separately. () ‘Tho sum operation can't be performed with the basic algebra operation. Objective Practice Sets [J | Computer Science & IT ESE 20] 63 MADE EASY 15. (c) Hes lIOTS)— Rls) (Orders) The above query evaluates those customers who ‘ordered through agent a, 16. (b) Query gives the roll no. and name of those sludents who are female (sex=1) and who are in maths department (d.name='math’) 17. (b) As Cis refering to R, and Dis primary key of R elt.) ~ Ro{t,) will give empty relation or empty table as numiber of values in Ccalumn of table r, will always refer to of respective values in D column of ry. 18. (c) From the options, option (c) is giving the best explanation of the query that it gives names of all students who have taken at least 1 course under their advisor. 19. (a) The query gives all those names who have issued/borrow a book from ‘Narosa’ but not ‘Allied! 20. (a) It gives the union of al the employees who are working in D.No. § or ate supervisor for the ‘employee who are working in D.No.S. 21. @) Fay (branch) ~ Req (Propery) (1) It gives those city names where there is no property. ay (branch) ((1)) Itgives those eily names having branch office and at least one property as cities with property have been eliminated 22. (d) FS-Ais equivalent o A. Except (d), remaining all relational algebra expressions are equivalent. 23. 24, 25. 26. () Rap (RX S)~ Pay 6 (Ran (RP< 8-c S) Pan elalelo| a ] 2 2 6 tuples are returned by the given query. (a) Option (a) is giving those book names and memiber names combination who have reserved the books and who are lecturers. © Rand Sare two relations ROR, RR) SPAS, 8) ())_T1,(D< 8): The query join the relation A and Sthen projact the column Ponly. (i) 11,(A) ba MIJS) : The query project the column Pfrom Rand Sand then join these projected columns so this produces same resuttin (i) (ii) 1, fF. Th, ofS)): The given query project separately the column Pand Qin both relations A and S. The intersection produces only these column which are common in both and finally projection produces the result the column P so this quory is also equivalent to (i) and (i. (4000) Since 'A' in Ry is not key, hence all value of A may oF may not be unique. Hence every entry Under A in R, will match with A in R,, Hence maximum is 2000. But A in Ris foreign key referencing Ain R, ‘Therefore minimum also 2000. ‘Sum is 2000 + 2000 = 4000 (GY objective Practice Sets Gamane easy www.madeeasy.in MADE EASY 27. (a) Block nested loop join sf] ~ 2 me te. ARs oer yt ‘Hof time ff block n man meray 1 (eck 49) LL. black ties 5a rane 28. (c) P >< Qis queranteed o produce fewer than or at most the same number oftupes a any of he other tables 29. (4) RDC S [right outer join of R and S} aALTeyTe[o] erie asa oa rf2jatu e | 7 | 3 | 1 nuu| 6 | 7 | 2 :. Number of tuples = 4 30. (240) R contain 400 tuples and values for A are uniformly distributed in the interval (1, 25] Number of values in [1, 25] = 25 Since numbers are uniformly distributed then a number repeats = 400/25 = 16 «+ Each value in domain repeats for 16 times, So number of tuples < 15 = 15 Hence, G15 (F) = 18 x 16 = 240 tuples. wummadeeasy.in Postal Study Course PUAE)| 31 32. 33. {MADE EASY DBMS © ind the name of althe students who have taken ailthe course ofthe department ‘C3 {tl3re Student (r[Sid]=f{Sid]) «(Wu € Course (u[Dname]="CS" = ase Takes (t [Sid] = s{Sid] asieid] = ufcid)))} Since P= Q= ~Pv Qtherefore (tre Student (r[Sid]=4Sid]) «(Vu e Course (u,Dname] "CS" vse Takes (t(Sid] = s{Sid] » s{cid] = ufcid)))}. (ce) (6) I" ALO -onee HE eye BEI bts / ee 6 tuples are returned by the query. (100) P bd Q = Commonatiribute = Cwhichiskey for both Pand Q. R, = P< Q = min(200, 300) = 200 tuples R, >a R= Commonattribute = Ewnichiskey for both R, and . R, ba R= min(200, 100) = 100 tuples So, [IP ba Q >a Rl = 100 tuples (3) lou sepi«ee (Course)! =0 Feq,cg(ENt0le9) He g(emply tuples in Dep!) Allthe distinet Sid wil be in the resutt Objective Pracce Sets e CHAPTER Q.1 Consider the following queries S,: SELECT ename FROM empe WHERE e.sal = ANY (SELECT sal FROM emp WHERE e.name =); S,: SELECT name FROM empe WHERE e.sal IN (SELECT sal FROM d ename FROM empe WHERE e.sal = ALL (SELECT sal FROM ‘s) Which one ofthe following is true? (@ S,,S,aresame — (b) S,,S,are same (©) Sj, Sy S,are same (d) None ofthese emp WHERE e.name Sy: SELECT emp WHERE e.name Q2_ Given relations A(w, x) and Sty, 2) the result of SELECT DISTINCT w,x FROM A, S: is Quranteed to be same as A, if (@) has no duplicates and Sis non empty (b) Rand Shave no duplicates (©) Shas no duplicates and Ais non empty (@) Rand Shave the same number of tuples Q3 A table Tt in a relational database has the following rows and columns: Rollo | Marke] 1 110 2 20 3 30 4 ut The following sequence of SQL statements was successfully executed on table T1 UPDATE T1 SET marks = marks +5; a4 as a6 SQL SELECT AVG (marks) FROM T1 What is the output of the SELECT statement? (@) 1875 () 20 © 2 (@) Null Consider the SQL query: SELECT DISTINCT a, Bgyony By FROM. Fy Foyny fy WHERE P. For an arbitrary predicate P, this query is equivalent to which of the following relational algebra expressions? (0) Raapnty Op (FFX son Fy) (0) Mp @9.0y Bp (FPR X ve St (0) Fay 20.89 By (FOU oo UT) (D) Fa apni Oy (Fy VGA on Mg) Consider the following queries: Q,: SELECT max (sal) FROM emp GROUP BY dept no HAVING dept no <> 10; Qy: SELECT Max (sal) FROM emp WHERE dept no <> 10 GROUP BY deptrno; Which of the following is false about queries? (@) Both queries can be used for the required result (©) Q, is faster than Q, (©) Q,is aster than 0, (A) None of these Consider the folowing relation schema pertaining to suppliers_parts database S(S#, SNAME), P (P#, COLOR) and SP denotes: the product of S and P. What does the following SQL query produces? ‘SELECT DISTINCT. NAME FROMS, WHERE S. S # IN (SELECT SP. S# FROM SP WHERE SP. P# IN (SELECT PP# FROM P WHERE P.COLOR = RED), G3 MADE EASY Postal Study Course BUXE| Dems | 2 What isthe result of following query? SELECT R.A FROM R WHERE R.B = NOT ALL (SELECT S.B FROM S WHERE RC. = S.C) @ [A ©) [A [at] vai) 2 3 22 a2) al © [A ® [A] a at 22 3 22 23 ‘Acompany has a storeroom, which consists of few employees who order products trom different shops. Followingis the snapshot of the “product- order” table maintained at company’s database, Product Order [Producto | Empioyeeno [Shope] Pi = 2 re 2 s rs & Se fe 5 5 fs a s fe = & Consider the following query SELECT A.product_no, A.employee_no FROM product order A, product_order B WHERE A.employee_no = Bemployee_no and Ashop_no < > B.shop_no} The number of tuples contained in the output wil () 4 be @ 3 os 2 Q.10 There are six tables describing @ company, (2). Getsupplier names fr suppliers who supply only RED parts (b) Get supplier names or suppliers wino supply atleast one red part (6) Get supplier name for suppliers who donot supply red parts (8) None ofthe above Q.7 Consider two tablesin relational database with columns and rows as follows, as epi | Dent are + | A 2 | 8 alc Roll_no isthe primary key ofthe student table, Dept id is the primary key of the department table and student. Dept idis a foreign key from Department. Dept id ‘What wll happen if we try to execute the fllowing two SQL statements? 1. update student set Deptid = Null where Roll_no 2. update Depanment set Dept_id = Nullwhere Deptid (@) Both t and 2 wl fa (b) + will fil2 wil succes (©) 1 will succeed but 2 wil fail (6) Both t and 2 will succeed QB LetA(A, 8, C)and SB, C, D)bethe relations as given below: R 8 ATe[e] [elepo at[otfea| [et]ct[aa] a2|ba| ct} [ba[o4 [at] a3|o3|c3} [ba] 3] aa] 22| 63 | 5 ail bi loe wormmadeeasy.n Gamaos Sass describing employees, departments, buildings, which department(s) an employee works in (and a percentage ofthe time for each), department managers (possibly more than one per department), and in which building an employee works (an employee may have more than one office). The primary key of each table is the attribute(s) in capitals. Other attributes are not necessarily unique. Objective Practice Ses © | Computer Science & IT at is} EMP (EID, EName, Salary, Start Date, Enc_Date) IN.DEPT (E10, DID, Percent_Time) BUILDING (BID, Bname, Address) IN_BUILDING (EID, BID) DEPT (DID, Dname, Annual_ Budget) MANAGES_DEPT (EID, DID) Which of te following queries finds the name of Deparments where no employees work? (@) SELECTDname FROM DEPT WHERE OID INSELECT DID FROM INDEPTI GROUP BY I.DID HAVING COUNT(*) = 0) (b) SELECTDname FROM DEPT D, IN_DEPT |, EMP E WHERE LEID = EID ana D.DID=I.DID and Count(E.E1D) = 0 (6) SELECT Dname FROM DEPT, IN_DEPT WHERE IN_DEPTDID = DEPTDID GROUP ByDID HAVING COUNT (EID) = 0 (¢) Both (b) and (c) Consider the fllowing relations Student (snum, same, major, evel, age) Ciass (name, meets_at, room, id) Enrolled (snum. cname) Faculty (id, name, deptid) What does the following query fnd? SELECTC name FROM Class C WHERE C.room = 128 ‘oC name in (SELECTE Came) FROM Enralled EGROUP BY E Cname HAVING count(*) >= 5) (@) Finds the names ot all classes that either meetin room R128 and have five or more students enrolled (b) Finds tho names ofall classes that eithor ‘moat in room #128 or have five or more students enralled (©) Finds the name of atmost one ciass that sithor meetin room 1128 or have five or more students enrolled (0) Finds tho names ofall classes that meet in room F128 that has five or more students snrolledinit SSEMiete201] GIMADE Easy Q.12 Which of the following SQL query is illegal {@) Select max (count(s) from group by A; (©) Select count(»), max (B) from group by 4; (©) Select count(+) rom F group by A; (@ Select count(s) from R; 2.18 Consider the folowing SQL queries Q1:Solect x from Art where EXISTS (select fom Rwherex = 1, 2:Solact x rom R where y= ANY (select x from Which of the folowing is correct? (@) Q, and Q, returns same resut. (0) Q, canreturn ess rows than returned by Q, (©) Q, can return more rows than returned by ce (d) Q, and Q, results have no relation. Q.14 Assume AYA, B) and S{C, D) relations have the following instances. [zTa] | re aeeel Find the number of tuples returned by the following query? (Select 8 from A) Union all = (elect aistinct C trom $) @2 3 @a4 Os Q.15 Find the equivalent SQL. query for the following relation Algebra query Tal6...¥) (@) Select A, Bfrom x, ywhere C= D (b) Select distict A, 8 from x, ywhere C=O (©) Select * from x, y where C: (2) None of these Q.16 Which of the folowing queries will give the names of employee who is eaming maximum salary? (@) Select name tromemp where sal = (select max (sal) from emp): () Selectname fromemp where sal > = ail (select sal from erp} Objective Practice Sets (9 MADE Easy nay [3] MADE EASY (©) Both (a) and (b) are correct queries but processing is too high in B than in A (6) Both (a) and (b) are correct queries but processing is too high in A than in B Q.17 Consider the statements 1: "Delete" Is used to delete the table from database. 2; “Truncate table” is used to delete all the data but not table. 83: ‘Drop tab well as table. is used to delete the data as Which of the above statements) is/are true? (@) Stand s2 (0) S2and 83 (©) Stands3 (@ St, Sand 83 Q.18 Consider the following statements with queries. S1: [Select + from R,, F's equal 10 [Rx] $2: [FA] is equal o [6,(R, xF,)} $3: ((R- 11> S] is equal to (R- > S Identity the valid statements? (a) Only st (©) 81,2 (©) 82,83 (51, $2, 8 Q.19 Consider the following query languages. L1: Relational Algebra. L2: Domain relational calculus. 3: Tuple relational calculus, 1L4: SQL without the aggregate operators or recursion. Find the equally expressive query languages? (All queries possible to state in Xtanguage if all those queries can be stated in other Ylanguage represents Xand Yare equally expressive query languages) @) by bats (O) Ly bay by () by bale (Ly Late be Q.20 The standard SQL "ORDER BY” clause {a) can be used to order the columns used in select (b) may only be used when "GROUP BY" is used (0) canbe used any place of query io order the tuples. wiwwimadeeasy.in Dp made Easy eo ceee) 2078] Dems | (@) can only be used as the last clause of a query to order the tuples. Q.21 Which of the following is correct? (@) An SQL query automatically eliminates duplicates (b) AN SOL query will not work if there are no indexes on the rotations. (©) SQL permits atribute names to be repeated in the same relation (d) None of the above .22 In SQL, relations can contain null values, and comparisons with null values are treated as Unknown. Suppose all comparisons with a null value are treated as false, Which of he folowing pairs is nat equivalent? (@) x= 5 not (not (x= 8)) (0) x= 5x54 andx <6, where xis an integer © x45 not(r=5) (@) None of the above Q.23 Consider the set of relations given below and the SQL query that follows: ‘Students: (Roll_number, Name, date_of_birth) Courses: (Course_number, Course_name, Instructor) Grades: (Roll_number, Course_sumber, Grade) SELECT DISTINCT Name FROM Students, Courses, Grades WHERE Students. Roll_number rades Roll_number AND Course Instructor = Korth AND Courses.Course_number Grades. Course_number AND Grades. Grade =A Which of the following sets is computed by the above query? (@) Names of students whohave gotan Agrade inall courses taught by Korth (©) Names of students who have gotan Agrade inall courses (0) Names of students who have gat an A grade Inatleastone of the courses taught by Korth (d) None of the above Objective Practice Sets 59 | Computer Science & IT RES 2o1s] GIMAOE EASY Q.24 Consider the relations, (2) Q,is the correct query Supplier (S_no, $name, city) and Item (Item_no, lem_name, Item_Brand, S_no) Which of the following SQL statement gives suppliers names who have submitted at least ‘one ‘Nestle’ brand item? (@) SELECT S_name FROM Supplier, Item { WHERE |, tem_Brand = ‘Nestle (6) SELECTS_name FROM Supplier S WHERE ‘Sno IN (SELECT S.no From item WHERE ltem_Brand = 'Nestie’) (©) SELECTS_name FROM Supplier S WHERE a2 (0) Q,is the correct query. (© Both Q, and Q, produce the same answer (@) Neither Q, nor Q, is the correct query Consider a database with three relation instance shown below. The primary keys for the Drivers and Cars relation are did and cid respectively and the records are storedin ascending arder of these primary keys as given in the tables. No indexing is available in the database. D: Drivers relation ai] crane [ana ae tem Brand = "Neste Z| Kethivoyan | 7 | (d) SELECT S_name FROM Supplier WHERE 23 ‘Saiman 1 33 5.no€XISTS SELECTS. no FROM Suppl, SL ane eL tem WHERE tem_Brard = Nest) [amet 8 Ps 0125 There re wo telatons Xend ¥ Relavon Xhas Sei serumecter| OHS arty 1 and cecnay 2, ration Ys ary 3 Bb testinal 5 tne cardinaliy 4. Inceate the resi of te SOL tl ences 8 statement SELECT COUNT (*) FROM X, Y. oat a os 95 Ralph’ 3 53 8 R: Reserves relation (d) Cannotbe calculated from given information: aid] cid aay 2.26 Consider the table employee (ama name 2 iO7] TORE epariment sear) andi wo queries 0, 0, 3 [108 | 707008 below. Assuming that department 5 has more 22 | 103 | 08/10/06 than one employee, and we want to find the 22-1104] 7/10/06 employees who get higher salary than anyone in, ‘31 | 102 | 10/11/06 the department 5, which one of the statements 31 {103 | 06/11/06 is TRUE for any arbitrary employee table? 31 {104 | 12/11/06 Q, Select e.empld 64 | 107 | 05/09 706 Fromemployeee ‘64 [702 [08709706 Where retexss 7 [103 [0603706 (Select = From employee # Where » ome rclaton department = "6" and s. salary > = e.salary) Q Select e.empld eid | ename | color From employee e 101 | Renautt | blue Where e.salary > Any 102 | Renault | red (Select distinct salary From employee s 103 | Ferrari [ green Where s, department ="5") 104 | Jaguar | red Objective Practice Sets_ gmRDE EnSe vwimadeeorn GQMADE EASY Eee 2078] What is the output of the following SQL query? select D. daname from Drivers D where D. did in ( select R. did from Cars C, Reserves R where Acid = C.cid and C. color = ‘red! intersect select R.did from Cars C, Reserves R where R.cid = C.cid and C. colour = ‘green’ ) (@) Karthikeyan, Boris () Sachin, Salman (0) Karthikeyan, Boris, Sachin (d) Schumacher, Senna Q.28 An athletics meeting involves several ‘competitors who participate in a number of ‘events. The database is intended to record who is to take part in which event and to record the ‘outcome of each event. As results become avallable the winner attribute willbe uodated with the cid of the appropriate competitor. Competitor (aid. name, nationality) Even (eid, description) Competes (cid, eld) ‘Conipetitor | [Event] [Compete] “B_[name [atonaiy| | wd | aeserinon | etd | eid or [ea [easen |for[rmee | 01 | oF ‘2_[ lay [aiah —|]02 | omoing || cz | oF | Sven_[Sweaeh_|| 08 | evowng || 03 | 02 Ge Pere Fenes | ~| 08 | 02 Identity he result ofthe following SQL statement, SELECT eid FROM Competes, Competitor WHERE Competes. cid = Competitor. cid ‘AND nationality = ‘Swedish’; @or () @ (©) 04 © 3 Q.29 Table GATE2016 has 16 records. It has a non- ‘null ‘Marks’ column which is also unique, Consider the following SQL query. SELECT COUNT(*) FROM GATE2016 ~_ wanwanadeeasy.in Dams | 5 WHERE MARKS > ANY (SELECT MARKS FROM ‘GATE2016), The value printed by above query is Q.30 In SL the statornent Select * from R, Sis ‘equivalentto (a) Select « From Rnatural join $ {b) Select « From Across join $ (0) Select * From Aunion join S {d) Select « From Rinner join $ Q.31 Consider the two tables in a relational database with columns and rows as follows: ‘Table: Employee Table : Department D_|_Name_[ id [id | Oname + [Suesh 1 ]f 4] cs 2 |sma | i || 2] ec 3 |Matesham| 2 || 3 | ME 4 [saya | 3 Dis the primary key of Employee table, Did is the primary key of the Department table. Employee.Did is a foreign key refers Department Did What will happen ifwe try to execute the following two SQL statements? (9. Update Employee set Dic (ii) Update Department set Di Did=1; (a) Both (i) ana (i) wil fall (©) (0 will fal but (9 will succeed (©) (@ will succeed but (i) wil fal (d) Both (#) and (x) will succeed lulwhere ID=1;, Null where Q.32 A database table Tt has 4000 records and. occupies 60 isk blocks. Another table T2 has 200 records and occupies 20 disk blocks. These two tables have to be joined as per a specified Join condition hat needs io be evaluated for every pair of records from these two tables. The memory butfer space available can hold exactly ‘one block of records for T1 and one block of records for 72 simultaneously at any point in time. No index is available on ether table. f Nested- loop join algorithm is employed to perform the join, with the most appropriate choice of table to be used in outer loop, the number of block accessesrequired forreading the data are EE | Computer Science & IT roe) G3MADE Easy Q.33 Consider the following SQL statements with its The above query finds name of the persons. number. (@) Who have not travelled in any city where SBI SELECT 1 islocated FROM 2 (©) Who have nol travelled in al city where SBI WHERE 3 islocated GROUPBY 4 (©) Who have travelled in all city where SBI is HAVING 5 located ORDER BY 6 (d) Who have travelled in any city where SBI is What is correct order (number sequence) for located evaluating an SQL statements? (where order is SB igit umber) Q.36 Consider the following table Q.34 Consider the following schema. AG, D), OB, C), A,B) Gis foreign key in Qreferencing A{C)on delete cascade, Bis foreign key in Preferencing @(B) (on delete set null. Suppose current content of P, Q. Ras follows AB) (eC) (Sob How many tuples resultater executing the query: pla al dja al Alaa SELECT Student Name, SUM (Gate Score) from lo o| [val [ba Gate 2016 group by Student Name After executing the following query, what are the ee eee eee tuples in P? .37 Consider the relation and query delete trom Project (Pro, Pname, budget, city) (a) (a, NULL) and (b, 6) SELECT Pname (&) (a, NULL)and(b, NULL) FROM project (©) (b,b)only where NOT(budgot >= ANY (SELECT budget (@) Pwill not be changed FROM project Q.35 Consider the following relations: Ce erel aha LA) Bank(bname, city) Which ofthe following output produced by above Travel(pname, city) ee SELECT T1,pname (@)_ Name of projects whoes budget is less than FROM Tevet every project in Kanpur city (0) Name of projects whoes budget is greater eres ace than every project in Kanpur city. irom Bare (©) Name of projects whoes budget is less than WHERE B.bname = ‘SBI equal to project in Kanpur city. EXCEPT (@) Name of projects whoes budget is greater SELECT T2.ity than equal to every project in Kanpur city FROM Travel 72 WHERE T1,oname = 72,name) (Ey ovjective Practice Sets (9 MADE Easy uUGE MADE ERSY Eom returns 3 tuples. (2) Select distinct C trom $= returns 2 tuples (1) Union all(2) = returns 3 + 2=5 tuples (keep duplicates) (b) My alOow oN) Itfinds A and B values from.x and yfor which C = D. Relational algebra also eliminates all duplicate values. () Both (a) and (b) will give the name of employee who is earning maximum salary {@) Select name from emp where sal = (select max(sal) from erp) in this nested query the inner query will go through alln tuples of emp database table, and will output 1 record, For this 1 record the outer query will output the name, So the processing time is 0(r. {b) Select name from emp where sal > = all (select sal from emp); in this nested query for every tuple of outer ‘query, its salary attribute will be checked with all tuple from inner query. Hence processing time will be O(n?) and O(n) < O(n? so processing ime in (b) is higher than (a). (b) "Delete" is used to delete the data specified in the where clause. If where cause is absent then itwill delete all the data from the table. "Truncate table” is used to delete all the data but not abie, ‘Drop table" is used to delete the data as well as the table. (@) Given all statements are valid, as pairs given in each statement will return the same result, 19. 20. 23. 24, 25. 26. 27. Taek 20s) GIMADE EASY (@) All given query languages are equally expressive, (a) “Order by” clause is used to order the tuples and it can only be used as the last clause of a ‘query. (c) ‘The WHERE condition checks for the Grade “A’and matching of course-numiber in the courses and Grades, where the instructor must be ‘Korth’, ‘Overall it checks for students to whom ‘Korth’ thas instructed and they have received Grade. A in atleast one of the courses taught by ‘Korth’, (b) Option (b) is correct as ‘IN’ condition will give the respective S.No. and will equate both $_No, But EXISTS will check if any tuple exists and it will give wrong answer (©) For relation Xcardinality For elation Ycardinality = Hence the SOL statement Select COUNT (") from X, ¥ ‘ives the number of rows forthe relation obtained ftom cross product of X,Y. Hence, 2x4 = Bis the correct option. (b) Query-2 will give the corectresutt butnot query- 1. Query-1 will check for employees who are working for department other than 8. Quéry-2 will check for all employees even for department as wel. () Select Rid from case C, reserves R where Acid = Ccidand C.color ='red' (1) Query (1) wil give: [aia] 22] st] 6a 22] 34 Select Rid from case C, reserves Rwhere Acid Cid and C.color = ‘green’ 2) Query (2) will give: [aig [32 | 34] 74 (1) intersect (2) will give: [aa] 22 37) The corresponding namias would be : Karthikyan and Bors, worwmadecasy.n G3 MADE ERSY 28. (b) whore ompstos. ‘compettorcid seein d= compat ove [ou Loe] 05] and nationality = ‘Swedish’ a It gives SS So corresponding eid = 02. 29. (15) This query counts the number of tuples with marks > minimum marks. All the tuples will have uniques marks. Hence only one tuple wi minimum marks. Therefore 15 will be the resul of the query (18 records will have marks greater than minimum marks). 30. (b) Even through the A and $ may have common attributes it would give output as cross-product unless we give explicit condition for tuple matching, ‘To make it equivalent to natural join we have to use WHERE condition to match the common attributes. 31. (c) First query will successfully execute and after executing this statement, attribute Did of Employee table with ID = 1 becomes ‘NULL’ which is foreign key from Department's Did, Now, second statement will not execute, because primary key cannot be NULL. 32. (15020) Nested Loop algorithm will involve n, x b,+ b, block transfers. 11, = # records in relation r, b, = # blocks in relation r 1n, = # records in relation s, b= # blocks in relation s Either T1 can be A or 72, If Ris TT then total number of block access is 4000 x 20 + 50 = 80050 www.madeeasy.in stal Study Course FIRE] 33. 34, 36, 36. 37, (Mave Easy Dems | If Riis T2 then total number of block access is 300 x 80 + 20 = 15020 Batter one Is the second case, total number of block accesses = (15020), (234516) ‘© Take all tables listed in 2 compute their ‘cross product ‘© Select rows of cross product that satisty the condition in 3 © Group the selected rows by altribute in 4 ‘© Select the groups that satisfy the condition ins ‘+ Project out the selected group attribute in 1 ‘© List the result by attribute in 6 (b) ‘Alter executing above command table Qwill be empty and table Pcontains (a, NULL) and (b, NULL), (c) Query computes name of persons who have travelled in every city where SBI is located. 6) Since all names are cistinct and all have gate score < 500 all rows will come in result, Student Name | GATE Score ‘Amjad 300 Sachin 300 Mukesh 150 Nagender 100 ‘Anand 200 Sushil 250 (a) Inner query finds all budgets of Kanpur city Outer query compare every record of project it budget greater than equal to inner budget the reject. So finally results: Name of projects whoes budgets less than every project in Kanpur city. Objective Practice Sets fe) CHAPTER a4 az as Consider three data items D,, D, and O, and the following execution schedule of transactions T,, and Ty Inthe diagram, AD) and W(D) denote the action reading and writing the data item D respectively Time] Ti % | % ROS: RO 04) RO) WD) ROY: MO, | m0, M03 RO, RO% 0, Ory (@) The schedule is serializable as Ty, Ty, T; (©) The schedule is serializable as TT, Ty (©) The schedule is serializable as TT. Ty (d) The schedule is not serializable Which of the following statements is/are correct? 1. Every view serializable schedule is conflict serializable 2. Every conflict serializable schedule is view serializable 3. Some view serializable schedules are contict serializable 4. No view serializable schedule is conflict serializable. (@) tony (© tand4only (©) 2and3only (@ 2and4only For the given schedule, which of the following true? a4 as a6 ee ecu al Transaction rea read(A) eats wena root em (a) The schedule cannot be serialized (b) The schedule is equivalent 10 Ty, Ty, Ty. Te (c) The schedtule's equivalent 10 Ty, Ty, Ty To (0) The schedule is equivalent 10 Tp, Ts, T. Te The goal of concurrency control in database systems is to (@) Allow only those concurrent executions of transactions that are equivalent to some serial executions of these transactions Allow only these transactions to execute concurrently that donot access any common relation (©) Execute transactions serially (@) Lock and unlock relations ©) Consider the following situations: 1, ‘Transaction T, is waiting for transactions T, nd Ty 2. Transaction T, is waiting for transtraction T,, 3, Transaction T, is walting for transaction T, Above situation may result into (@) Starvation of T, (0) Deadlock state (c) Nodeadiock state (@) Data not sufficient What is the potential problem whon a DBMS executes mutipe transactions concurrently? {a) The lost update problem (0) The dity ead problem fa mabe Easy (6) The incorrect summary problem (@) Allof the above Q.7_ Which of the following scenarios may lead to an irrecoverable error ina database system? (a) A transaction writes @ data item afer it is read by an uncommitted transaction (0) Atransaction reads a data item ater itis read by an uncommitted transaction (©) A transaction reads a data item after itis written by a committed transaction (6) A transaction reads a data item after it is written by an uncommitted transaction Q8 Assertion (A): The following schedule is not conflict serializable schedule Reason (R): There is not any cycle in this schedule Time] 7s Tt % RO) ria) Re) may RO) Ro) RE) FA) \ Re) RO) ma) me) RO) {@) Both (A) and (R) are rueand (A) isthe correct reason for (A) (©) Both (A) and (A) are true but (R) isnot correct reason or(A) (©) Both (A) and (R) are false (@) (A)is true but (R) is false Q.9. Consider the following two schedules: ie z 7 [| % 7 [ea wma) Rie) my | we) i & Fue} | wie) “ ¢ & ya) Postal Study Course PURE| (gmap easy pams | Which of the following statement is tue? (@) tisrecoverable, but 2is not recoverable (b) 1isnot recoverable but 2is recoverable (©) both 1 and 2are recoverable {d) both 1 and 2are not recoverable Q.10 Consider three data items D,, D, and D, and the following execution schedule of transactions T,, T,and Ty, In the diagram A(D) and WD) denote the actions reading and writing the data item D respectively. Te] | [a] RO RD wes) | FID, v0, Ay oH m3 M3 FD): FD: 03 04h (@) The schedule is serializable as Ty, Ty T, (b) Tho schedules serializable as Tp, Ty, Ty (©) The schedule is serializable as T,, Ty, T, (@) The schedule isnot serializable Q.11 Arace condition occurs when (@) two concurrent activities interact to cause a processing error () two users of the DBMS are interacting with different files at the same time (0) two uses trying to obtain write lock on same data item (@) none of these Q.12 Consider the following schedules, which of the following schedule is contict serializable? (@) Tals), Tle), T,:WM(x), T,scommit Teeommit {) TeAts), TeALY), TM), TRC). TeAW), Tacommit, zcommi, T:commit (©) Tx), Ty:Alx), T,X), Ty:commit, T,: Abort (0) TAG), Ta), TM), Ty Al), Ty: commit, T,commit, T,commit Objective rate ets Q.13 Consider the following two transaction schedule: [Schaar] a RA R3 wa Re Ra Ra | wa | we | we. c ¢ c | c Schedule? 7 Taps PA rT | Re : wa | we | wa we we c ° © ce | Then which of the above schedule is serial equivalent? (@) Both schedule t and 2 (b) Only Schedule 1 (©) Only Schedule 2 (d) None of these Q.14 Consider the following schedule: LON. RCD, WL), A(X), W(X) Which of the following is true regarding the given schedule? (@) The schedule is conflict serializable but not view serializable (©) The schedule is view serializable but not conflict serializable (c) The schedule is view serializable as well as conflict serializable (@) The schedule is neither view nor conflict serializable Q.15 Assume there are 10 transaction : Ty, Toy» Ty Every transaction writes a value of variable X that is read by ils successive transaction, ike T, writes CE ov nctive racic Sts stal Study Course BXEE]| (made Easy [3 made Ensy value of Xthat is read by T,, T, writes a value of X, that is read by Ty, ..., Ty writes a value of X that is read by T,,. Now, if T, falls, then total how many transactions are required to recover the schedule? Q.16 For the given schedules S tind out the contct equivalent schedule St AU) leh Hah Hk of TIA Wh2}; MOLY) @ ToT, © ITT, yc) wely ©) T.> > T (b) None of these Q.17 Amongst the ACID properties of a transaction, the Durability’ property requires that the changes made tothe database by a successful transaction persist (a) Exceptin case of an Operating System crash (©) Except in case of a Disk crash (c) Except in case of a power failure (@) Always, even if there is a failure of any kind Q.18 Consider the following three schedules of twansactions T1, T2and 73. [Notation: In the following NYO represents the action ¥ (¥ for read, W for write) performed by transaction N on-object 0} (aA WA SAG 2B WA SHE TRA IRB WA 1 {52 AC A 2A 249 WA TRA TAB WA MB aN 653 A FO BWA HK BMG SHO TRA TAB MA. Which of the folowing statements is TRUE? (@) $1, $2 and $3 are all conflict equivalent to act other (0) No two of $1, $2 and $3 are conflict equivalent to each other (©) $2is contlict equivalent to $3, but not to $1 (@) St is conflict equivalent to $2, but net to $3 Q.19 When n transactions are run concurrently and in an interleaved manner, the number of possible schedules are (a) much larger than n! (©) much lower than nt (©) much larger than (n— 1)! (@) much lower than (n— 1)! wurwmadeeasy.in Q.20 Which ofthe folowing is true? 22) (@) Every schedule which is not conflict serializable but view serializable must have some bliond write, (0) Every schedule which is not conflict serializable but view serializable mayimay Not bliend writ. (©) Every schedule which is not conflict serializable and no bliend writes can be view serializable, (@) Every schedule whichis confit serializabl andno biiendwritesis may not view serializable. Consider the folowing schedule. WAY), Pyle), PC), Wk), Wala), Ca, WLW), Cy Welinh, Cy 2), Cy Which of the following transaction order is not possible in the given serializable schedule? @ Tho hot 0 9h 9 Rot © T3R3% 9% @ Tho hoh Q.22 Consider the following schedule File) leh WA Ce): Rh: Wil): Con Ay The above schedule is (@) Recoverable and conflict serializable (b) Recoverable and not conflict serializable (c) Not recoverable and conflict serializable (@) Not recoverable and not conflict serializable Q.23 Considerthe given schedule wwww.madeeasy.in 7h [Roy Fe) AY) xexty Ws) AGL commit commit ‘The given schedule is (a) Recoverable and cascadeless (b) Recoverable but not cascadeless (c) Notrecoverable (d) Recoverable, cascadoless and strict ostal Study Course BIE| (Mme Easy Dems | 2 Q.24 Find the schedule from the following which is serializable but not recoverable schedule? [C, is ‘commit operation of iransaction 1], (@) R,(@), Wi(a), Rela), Wa), Cy, Cy (b) Fila), Ra), Wala), Wa), C,, Cy (6) y(a), Wy(a), Py(@), W2), Cy, Cy (8) Ry(@), Wa), Wa), Ryla). Cy, C, Q.25 Match List-1 with List-Il and select the correct ‘answer using the codes given below the lists List-1 A. Wa RO) B. Ayla): Weta) C. Wx): Wile) Liste 1. Dirtyread 2. Overwiting uncommited data 3, Unrepeatableread Codes: A @1 (bo) 4 (2 2 e+eno aeneo 2.26 Match List-I with List-ll and select the correct sing the codes given below the lists: List (Schedule name) Recoverabie Csecade less Strict Non-recoverabie List-il (Schedule with example) 1. YA), WB), Fy(B), Cy, Cy 2. WA), WALA), Co, WALA), Cy 3. AYA), WB), Cy Fy(B), W4(B), Cy 4. RA), WB), R,(B), Cp, Cy Codes: ABCD ee eee (aoa st 4 2 3 4 eee Objective Practie Sets a2 a28 29 | Computer Science & IT Consider the following schedules SY: Wala), Wyle), Pex), Pls, WAU), POA. 2), Ax) 2: R(2), Wa), Waly). Fy), Fale) Fyl2), ROA, Wi) SB: RZ), Wola), WLy), W(x), F(x), Fala), F(z), Rey) Which of the schedules are serializable? (@) St, 82 (bo) $1, $3 (0) $2, $3 (@) None of these Match List-l with Listll and select the correct answer using the codes given below the lists: List-l WR conflict RW conflict WW contlict List 1. Unrepeatable read 2. Phantom read 3, Lostupdate 4, Reading uncommitted data os> Codes: A BC @4 1 3 (Fd 8-9 @ 2 4 3 (ce Which of the following is true about the schedule 8? 7 Te 7 ROO |_| Ref RO) FX) [aw Woo, __| Commit RM ma way Commit Peers Ga mApe ErRsy (a) Irrecoverable and cascading (0) Rocoverable and cascading (©) Recoverable and cascadal (@) Imecoverable and cascadsless Q.30 Consider the following schedule S, ast 84: A,(O) F,(C) W(A) WIA) W(C) R(B) RAB) W,(B) W4(D) WB) WD) FCF) WE) ACF) Let'X be the number of ‘blind-write' operations In the given schedule and ‘Z be the number of conflict equivalent serial schedules to S,. The value of X+ Zis Consider the transactions T,, Tp, and T,and the schedules S, and S given below. Ty M00: (iw OY HQ, Ty: 2 (M12 (2) w2(2) Ty: (M800; 08.(1) $1 (39; (Mi BX); 12(M9; 2 (Zh WHY) WO (JiND; oA; w1(2) 11.0%; 13 (19; 2M} 8); we (2) 5 C2) 22); wa (YY, W(X); WALZ) ‘Which one of the folowing statements about the schedules is rue? (@) Only S, is contict-seriaizable (0) Only 8; is conflct-seralizabl. (©) Bath S, and S, are confict-serializable (3) Neither 8, nor Sis contict-serializable Q.32 Consider the following schedule 2 1300, 0. WAL, ON, (0, 4010, W100, WAY) How many minimum number of moves (where a move consists of changing the position of one of the operations) are required to convert into conflict serializable schedule? Q.33 Consider following transactions fgmace easy 4. F(A) WA) 1B) (8) 2. w AB) wiA) How many non-serial schedules between T, and Tywhich are serializable? @1 (b) 2 @a4 0 wurw.madeeasy.in MADE EASY Q.34 Consider’ transactions T,, T, and Tshaving 2, 3 and 4 operations respectively. Find number of concurrent schedules, Q.35 Consider a set of 2 transactions T; and J; with number of operations as 6 and 7 respectively. The number of concurrent schedules possible are (@ 13! (b) 1716 (©) 6x7! (2) None ofthese Q.36 Consider a simple check pointing protocol and the following set of operations in the og, EXE teonsaction GC (et Ob 0) g 10. (d) 11. fa) 12 (b) 13. (d) 14. 20. (a) 21. (&) 22 (@) 23, (b) 24, 29. () 31. (©) 33 @) 36, FEENEY tonsacin 1. @) ‘The precedence graph of the given schedule is (o) 36 i) Since there is a cycle in the precedence graph, the schedule is not serializable. 2. (b) Every conflict serializable schedules are view serializable but vice-versa is not true. However some view serializable scheduls are conflict serializable, 3. (c) The precedence graph of the given schedule is Postal Study Course ELJE] ) ©) © © G3 MADE EASY Dems | Gian, T,); (Start, T,); (Write, T,, a, 2, 8) (Write, Tz, 6, 1,2) commit T,); (Stat, T,) (Check point) (Write, Ty, 64,7) (commit, T,) If crash happens now and the system tries to recover using Both und andi redo operations, what are the contents ofthe undo list and red list, (@) Undo: 7,75; redo: T, (0) Undo: Treo : 7, (© Undo: T,; ted: T, (@ Undo: redo :T, Ch () <6 GO) th 0) 16. (2) 17. @) 18 (@) 19 (b) 25. (b) 26. (©) 27. () 28. (a) ‘Therefore schedules equivlentto Ty Ty Ty Tea Ty Ty Ty (c) Precedence graph for the situation is A nm) ®@ Since the graph has no cycle, the system is not ina deadlock state. (¢) All the problems are potential when a DBMS executes multige transactions concurrently ~ (d) Irrecoverable error would be when a transaction reads a data item after it is written by a transaction which has not been committed yet. Objective Practice Sets | Computer Science & IT 8. (a) 1) % ® 10. (6) Because there exists a cycle in precedence graph. r me 7 r G ; 7 e a) os If precedence graph consists cycle it is not conflict serializable otherwise it is conflict serializable. (Ey objective Practice sets Postal Study Course EXHE] Gamaoe easy Gammoe ersy 13. (0) Precedence graph of schedule 1 ‘There is a cycle between T, and T, Procedure graph of schedule 2 @—O . There exists a cycle between T, and T, 14, (b) There exists cycle in precedence graph = 2 and reer anise, a ay) 09 woo L | | wo | View Serializable schedule is fy BTR | Rom a wo wo | ven 15. (10) In order to recover the schedule, all the 10 transactions are required as the successive transaction is dependent on the data updated bby previous transaction like T, is dependent on a variable which is updated by T,. As T, falls, T, is also required to be recovered, Now if T, is recovered, T, is also recovered as T, depends on data updated by T,, Likewise, ithappens for all the transactions til To. wuw.madeeasy.in G3 MADE EASY 16. (a) 83) 2) ls) (0) ys) WO) LA 2) 9) The topological sorting / ordering of above graph is: hy TT, 19 Tiss the confict equivalent schedule 18. (d) Ss Gi mT cs RA wa) Cc RO. wey was mo au) Ae) a) a ec) l Ss ty th ts ea ‘ | m9) \ | al } 22, ai) wer | Sy Ty 1 cont par a | aw) | ae) | wa) me | ee "mabe Ease Postal Study Course BDI) Dems | ‘As we can see S, and S, are conflict equivalent to each other. The equivalent serial schedule is G a While the schedule Ss having a conflicts pairs ‘and equivalent serial schedule is not possible. Hence option (d) is correct (b) When n transactions are running concurrently and Inan interleaved manner, the number of possible schedules are around n. (a) If schedule is not contfict serializable but view serializable than their must be a blind write. Way Blind write The possible orders Tone Toho % ete Tents 2: TT, Ty Tyis not possible, Ty > Ta is not serializable So option (4) is correct. (@) Schedule is recoverable, because thereis no dirty read. there exist dirty read (W-F), then commit after parent of dy read. ie., if T, reads afer T, writes over same data item x then T, should commit after T, comrrite = Schedule is conflict serializable [not forms a cycle] (©) Recoverable but not cascadesless. For cascadeless T, should read the value of x only after corimit operation of Recoverable because T, commits first Objective Proce Sets 24, 2. 26. 27. 28. GJ | Computer Science & IT (c) 29. (@) Serializable (T, — T,] Recoverable [T, reads ‘a’ after T, writes, hence T, commits after T,] ()Not serializable (7, - T,, Tp > Ty] Recoverable [No read after write] (©) Serializable {T, -> Tz] Not recoverable [T, commits before T,] (@)Not serializable and not recoverable + Option (c) is serializable but not recoverable schedule. (b) Diny read is W-Acontlict [4-1] Overwriting uncommited data is W-W conflict {c-2}, Unrepeatabie read is R-Weonflct [8-3] 30. ©) (@) Recoverable AYA), WAB), F,(B), Cy, Cy (4) (0) Casecadeless: WA(A), WelA), Cy, WALA), Cy 12 (c) Strict: RA), WB), Cp, Ry(B), W,(B), C,; [3] (@)Non recoverable: AYA), WelB), F,(B). Cy, Op (1] Note: Strict schedule is recoverable and casecadeless schedule. Casecadeless schedule is always recoverable (c) 31 qenoh sho BYR: ROR $8: FEhIH + 1,91, 975 ceased 2+ Sand SBare serializable. [S1 forms a cycle between T, and T,] (a) The following contlicts leads to respective problems WR conflict : Reading uncommitted data, RW conflict : Unrepeatable read WW conflict : Overwriting uncommitted data. Objective Practice Sets Postal Study Course EME] (mace esa GamApe Easy () schedule is said tobe irrecoverable if T,reads A which is updated by uncommitted 7, and commit of 7,is before T; The given schedule does not have uncommitted read. So it is recoverable and cascadeless recoverable. (0) Blind-write: Write operation on a data item without having @ read operation on the same data item before The following are 5 biind-writes: WA), WAA), W(D), WD), WE) 5 The precedency graph for above schedule S, is shown below oe ® Since cycleexstin he graph, the nurrber of confict serializable schedules are zero .¢. Y=0. X¥=0. (ce) S100; B(N; A(X); 2(Y); 12(Z); wa); we) (2); WAX; WA) Nocycle => $1 is conflict serializable, Sei 1X); BUM 2M); AIX) W2(D; AMD; 21D, WKY); W(X); WA(Z) C0 No cyclo = S,is conflict seraizable MADE EASY 32. (2) 34. Precedence Graph: OE C G If w,(V)is shited before r(¥). So frst we have to move w,(¥) before f,(X), then w,(Y) before r3(Y) thon graph becomes. 35. B 33. (a) Number of concurrent schedule between 7, and T, (442) 6! 36. Gs Ol ag aiat ~ aai Number of serial schedule = 2! Number of nor-seril schedule = 15-2 = 18 But serializable schedule equalto 1, T, srl 7 =——: a (Alen (A) (BB) 7 Bw 6) Serializable schedule equal to T, — T, serial % ] t —— vB) (Ay ayn) (88) Out of 13 non-serial schedule, none of the schedule equal to serial schedule, Number of non-serial schedule which are serializable = 0, Gg MaDE EASY www.madeeasy.in Postal Study Course BJF Dems | (1260) If T,, Tzand T, are transactions with p, qand r operations respectively Number of concurrent schedules = eset at 213/41 2x6x4l 9x8%745%5 «69.99 2x8 = 128 (b) Tas’ operons and Than operations ten sunberef coneurent checes ae (nem 73) win BT tox ttxaxe= 1716 (b) In data base until check point not come data is not saved permanently, when checkpoint is comes all database until checkpoint all data stored permanent Alter checkpoint process which are committed ate redo and which are not committed are undo: So, undo isto be transaction T, redo is to be transaction T, Objective Practice Sets ) CHAPTER Qu a2 as as as ‘The concept of locking can be usad to solve the problem of (@) Lostupdate (0) Uncommrited dependency (c) Inconsistent data (@) Allof the above ‘Assume transaction Aholds a shared lock on R. It transaction B also requests for a shared lock on A, What will happen if rigrous twa phase locking protocol is used? (@) Results in a deadlock situation (0) Immediately be granted (c) Immediately be rejected (@) Be granted as soon as its released by A Which of the following is a false statement? (2) Multiple granularity protocol is a variation of 2 Phase Locking protocol. (0) Wait-Die protocol prevents dead lock and starvation, (c) Aschedule Sis recoverable ino transaction Tin Scommits until all transaction T' which writes an item that Treads, have committed, (@) None of the above. Inwait-die scheme, tanasactions 7, and T,have timestamps 7 and 9 respectively If T, requests a data item held by T, then (a) T, will wait (b) T, will be rolled back (©) T,will wait (@) T,willbe rolled b: In wound-wait scheme, transactions T, and T, have timestamps 7 and 9 respectively. If T, requests a data item held by T, then (e) T, will wait (0) T, wil be rolled back (©) Twill wait (d) Twill be rolled back eee Concurrency Control a6 a7 as Techniques Which of the following statements is true? (@) Wait-die is a preemptive technique (b) Wound-waits a non-premptive technique (©) Wait-die and would-wait are the schemes for deadlock recovery (¢) Wound-wait and wait-die schemes avoid stravation Consider the schedule given below. T, and 7, are two transactions and x and y are two resources th read_lock(y); read_itemy): read_lock(x) read_item(x) vwte_Jook(s) wrte_lock(y) The schedule indicates (@) serializable schedule (©) non-serializable schedule (©) Adeadiock schedule (@) None of the above Which of the following is/are true for transaction processing? 1. A transaction is a program unit where execution preserve the consistency of the database 2. Two-phase locking is used to prevent unauthorised user access to a database record 3. When a read-lock is acquired for a given record all other transactions will nat have rights to read that record, 4. A record of all transactions and the corresponding changes to the database is recorded in alog MADE EASY (@) 1,2and3 (©) tanda (b) 2and4 (6) 1.2and4 Q.9. Consider the following schedule. 144), RA), UA), LIA), WA), USA), 1A), WA), aA) Identify the schedule ? {a) Schedule satisfies 2PL and conflict serializable (0) Satisies 2PL and non-contct serializable {c) Not satisfies 2PL and conflict serializable {¢) Notsatistes 2PL and not confct seraizable Q.10 Match List- (Simultaneously held locks on some object) with List-ll(Group-mode for locks, if they are compatible) and select the correct answer Using the codes given below the lists: st List. A. S.S,18 1s B. IXISIS 2.1K ©. 1K.X 3. 3x D. SIX IS 4, Not possible Codes: ae 6) «C). 0) @1 23 4 1243 @1 32 4 @1 342 Q.11 Which of the following is true? (@) Schedules which are allowed under Thomas write rule are also allowed under Basic times stamp protocol (b) All the schedules which are allowed under basic time stamp protocol are also allowed Under multiversion timestamp protocol (0) All the schedules which are allowed under ‘multiversion time stamp protocol are also allowed under Thomas write rule (2) All of these Q.12 Consider the statement with regards to time- stamp ordering protocols, 1. Starvation to a particular transaction is possible. wu madeeasy.in Postal Study Course BZED ‘MADE ERsY Dams | 2. Itensures recoverable schedule. 3. Itensures conflict serializable schedule. 4, Willnot allow dead locks, Which of the above statements are true? (@) 1and2 (b) 1,2ana4 (©) 1,8and4 (d) All Q.13 Which of the following is true for two-phase locking? (@) lock acquisition is the second phase (b) locks can be acquired at any time (©) locks are acquired in the first phase (d) None of the above Q.14 Consider the following statements, 8,: Entre database can not be locked. S,: Entire relation can be locked. Which ofthe above statements is/are true? (@) S, only (b) Sonly (©) Both S, and S, are true (@) both S, and $, are false Q.15 Choose the false statement (@) Timestamp protocols deadlock free. (b) Two phase locking guarantees serializabilty (0) Strict two phase locking is deadlock tree, (6) Timestamp protocol may not result recoverable schedule, Q.16 Which of the following concurrency control protocol eneures both confit seralzabilty and freedom trom deadlock? (i) 2 phase locking (ji) Time stamp ordering (@) (only (b) (and (ii) (©) Giyonly (@) None of the above Q.17 Suppose that process P has been running for several days when a new process Q starts up and begins contending with P for resources. Which of the following is true? (@) Inawait-cie system, it Pneeds a resource held by Q, then Pwaits Objective Practice Sts | Computer Science & IT EEC 201s) GI MADE EASY (b) Inawait-die system, if Qneeds a resource Q.21 Consider the following two transactions : T, held by P, then Qwaits. and Te, (©) Inwound-wait system, ifP needs a resource 7 fs held by ©, then Q yields and waits. aor RGF (@) In a wound-wait system, if Q needs a RCo) Ric resource held by P, then Qdies, Re: Ras Q.18 For the schedule given below, which of the ea eae eran following is correct? ae — 1 Read A Which ofthe following schemes, using shared 2 Read 8 and exclusive locks, satisfy the requirements for 3° Write A strict two phase locking for the above 4 Read A transactions? 5 Write A @ si: s2 6 Write B SA) S(By 7 Read 8 RA): AB) 8 Write 8 S(O) SIC; {@) This schedule is serialisable and can occur ACC) RO: ina scheme using 2PL protocol S(B) (A; (b) This schedule is serialisable but cannot occur ACB): RA): ina scheme using 2PL protocol. ifA=0 ifB+0 (c) This schedule is not serialisable but can then Be Bx 5; then Ae A/5; ‘occur in a scheme using 2PL protocol WB way (d) This schedule is not serialisable and cannot c, Ga ‘occur in a scheme using 2PL protocol uniock (4); unlock (8); unlock (Ch unlock (0) 2.19 Which of the following is tue about 2-phase unlock (8), uuniock (4). locking protocor? (o) St: $2 S,: Lock upgradation and degradation are x(a) (8) allowed oniy in shrinking phase. RIA) RIB) S,: 2-phase locking allows lock degradation in 8(0; S(O: shrinking phase RO) RIO: (@) Only S, (b) Only S XB); XA): (©) Both S,and$, (d) Neither S, nor S, ACB) RA) .20 2PL guarantees seriaizabilty, but it does not ee Meee provent deadlocks. 2PL has two phases Cr KeE ss, eee growing and shrinking. Which of the following we) was rules are used to govern the 2PL protocol? unlock (4): unlock (4); (@) Two transactions can not have conficting wreck Or uatock (Ch forks. unlock (8); unlock (4); (©) No unlock operation can precede a lock ors 55 ‘operation in the same transaction, rn a (©) No data are affected until all locks are : : RA) RB) obtained i.e, until the transaction isin its 4 : SO; SICK, locked point al aa @ Allof these [ZI] objective practice Sets Ggmaoe ensy ayn GQMADE EASY EE 2075) ems | x(B) XA); Q.22 Consider the following sequence of actions. ae nee 1A) 1B) v4.0) (8) (0) w (8) WA) Tn (ear Utich of he felowing time stamo ordering w@) 7 way 7 allowed to execute the schedule using basic time ; stamp protocol? joo ee eae {@) (Ty. Ty T.)= (10, 30,20) unlock (8) uniock (8) (b) (T), Ta, Ty) = (20, 30, 10) G G (0) Ty. Tes T)= 0,20, 10) (@) st $2 (9) (Ty, Ty T,) = (10, 20, 30) sia; s(Bi @.28 Consider the folowing schedule Be A F(A) 1B) ve O) 4B) r(C) WB) (4) RO: AUG Which ofthe following timestamp ordering allows X(B); x(a) toexecute schedule using Thomas wre ul time RB: ROA: stamp ordering protocol? ifA=0 it B20 ©) (T, Ty. T2) = (10, 30, 20) then Be Bx5; thenA —A/5; (b) (7,, Tz, T,) = (20, 10, 30) WB): Weal: (©) (T, Te Ta) = @0, 20, 10) unlock (A); unlock (B); (A) (T,, Ty Ty) = (10, 20, 30) unlock (C) unlock (C} GQ CG inlock (8); unlock (4) EXEEXIEN concurrency contro! Techniques LoO2zOs ©4405 O68 O27 08 © % & 10.) 11. (b) 12. (©) 13 ©) 14 () 15. (@) 16. (©) 17. (@) 18. (0) 19. (©) 20. &) 21. @ 22 @ 23. Objective Practice Sets | Computer Science & IT 4, (@y Inwait-die scheme, when transaction 7, requests a data item currently held by T, T,is allowed to wait only fit has a timestamp smaller than that of T, Thus when T, requests a data item held by T,, then T, will wait, 5. (d) In wound-wait scheme, when transaction T, requests a data iter currently held by T, then T, is rolled back if timestamp of Tis larger than T, ‘Thus for the given question, data item will be preempted from T, and T, will be rolled back 6. (c) \Wait-dieis a non-preemptive technique. Wound- ‘wait is a preemptive technique. Wait-die and deadlock prevention, Both the schemes avoid starvation, Wound-wait are the schemes for 7. (©) Transaction T, is waiting for data item.x, which is held by T,. And Transaction T, is waiting for data itemyy which is held by T,. Both transactions need Exclusive locks so the situation is in deadlock state 9. (a) Alter unlock over A, it lacks again on A. Henee it is not in 2PL. O—@ ot confict serializable, 10. (b) * 8, S,1Scan held with shared [1] * IX IS, IScan held with X(2] * IXand Xare incompatible, so not possible [4] + SIX, 1Scan held with SIX[3] 16. (c) Time stamp ordering ensure both conflict rializabilty and free from deadlock. (2 orjective Practice sets B Postal Study Course PIE| EEEEENII concurrency control Techniques 19. 20. 24 22, 23. MADE EASY G3 Ma0E Ersy (by According to 2PL. if lock conversion is allowed, then upgrading of locks must be done during ‘expansion phase, and degrading of locks must bbe done in the shrinking phase, S,is true, Lock upgradation is not allowed in shrinking phase therefore S, is False. (b) No unlock operation can precede alock operation inthe same transaction, (a) Requirement to folow Strict 2PL. 1. Exclusive locks should be released aterthe 2. NoLacking canbe done after the fist Unlock In 2PL, deadlock may occur but it may be thatit doesn't occur at all, Consider hatin option (6 both execute in serial order without concurrency then thats perfectly valid and YES itolows Strict 2PL (a) Time stamp order is equal to the conflict equal sorial order. Precedence graph: @ T, (10) | To (20) [Te (20) (A) 8) wic) wi8) (0) (8) wiA) W,{8), W.{8)is allowed in TWR, a4 a2 as a4 Qs a6 CE eae 7 File Organization and Indexing ro Match List-l with List-ll and select the correct answer using the codes given below the lists: List Listll Primary index 1, Dense Clusteredindex 2, Sparse Secondary key index Secondary non-key index Codes: pomp @ (©) () ® Blocking factor is applicable for_orgenization (@) Spanned (b) Un-spanned (0) Both (@) None of these naaw> C20 12 el 24 a ie a Each block of 8 tee of order ‘n' can have (a) 1-1 key values, and n pointers (b) 7+ 1 key values, and n pointers (0) key values, and m+ 1 pointers (d) Cannotbe determined Dense index is so called because (a) Itnotmally keep one key per data block (b) Every key from the data fle is represented inthe index (©) It requires many fewer blocks than the sparse index (d) None of these Duplicates are allowed in (a) BTrees. (0) 8° Trees (0) Both(a)and(b) (4) None of these Which statement s true for a 8 tree? (a) Allentries of anode are greater than or equal to the entries in the node's children, (b) Allleaves are al the exact same dep! ar as Qo ato (c) All nodes contains the exact same no of entries. (d) All non-leaf nodes have the exact same number of children. The physical block is the smallest physically addressable unit of data on a disk. The disk block addresses are used to access a physical record. The blocking address consists of (a) Cylindernumber (b) Surface number (6) Blocknumber _(d) Allof the above Bireeallows (@) Sequential access only (0) Random access only (¢) Both sequential and random access (@) None of these ‘Assertion (A): Second level index in multilevel indexing will be always a primary index. Reason (R): All indexed files will be always physically ordered files. Which one of the following is true? (@) Both (A)and (R) aretrue and (R) isthe reason for (A) (0) Both (A) and (A) ate rue but (R)is not correct reason for (A) (©) Both (A) and (A) are false (@) (A)is true but (A) is false Ina database file structure, the search key field is 9 bytes long, the block size is 512 bytes, a record pointer is 7 bytes and a block point is 6 bytes. The largest possible order of a non-leat node sa B* tree implementing ths file structure is (@ 23 (©) 24 (a 4 | Computer Science & IT key field K. A B tree of order Pis used as an access structure on k, where P denotes the maximum number of tree pointers in a B tree index node. Assume that k is 10 bytes long; disk block size is 512 bytes; each data pointer PIs 8 bytes along and each block pointer Pais S bytes long in order for each Btree node tofitin a single disk block, the maximum value of pis (@) 20 (0) 2 () 2 @) @ Q.12 Given a data file with N(e.g. 100) records per page and M(e.g. 1000) pages and anindex page capacity of $12 index entries, how deep should bbe the 8" tree to index this file? (1 (o) 2 3 @4 Q.13 Match List-I with List-ll and select the correct answer using the codes given below the lists: List-1 List ‘A. Secondaryindex 1. Functional dependency B. Nonprocedural «2, B Tree Query language C, Closure ofasetof 3. Domaincaleulus attributes D, Naturabjoin algebraic 4, Relational operations. Codes: A B CD @ 2 3 1 4 3 2 4 1 @m 3 1 2 4 @ 2 1 4 3 Q.14 Consider the faliowing B* tree sels mn / eek See sas What wll be the resutng 8 tree afterinsering 80, Assume B" tree incorporate rotation technique (CY objective Practice sets a Postal Study Course EOI] Q.11 Consideratable Tina relational database with a 15s MADE Ease MADE ERSY © Gasp eros) (s«0[e0] [ss [[eo [ve [Ts] aay Sas aaa) (2) None of the above Consider the following B* tree with the corresponding guidelines Guidelines + Number of keys/page = 4 Number of pointersipage = 5 Fillfactor = 50% Minimum keys in each page = 2 \While combining aleaf page, combine it with its eft sibiing Rotation technique o inserting is notallowed The root node and Intermediate nodes are index pages. ‘+ Incase when leaf page Is fl, then while splitting the leaf page middle key is placed in the index page in sorted order. Records with keys < midlle key go to lft leaf page. Records with keys > middle key go to the fight leaf page ‘While index pag is full then while spliting index page, keys < middle key go to left index page and keys > middle key go to the right index page. The middle key goes to thenext (higher level) index. Itkey value 95 is added 10 the above B* tree the root page of the resulting B* ree will contain (a) 60 (b) 25, 50, 60, 75 arg (0) 25,50,75,80 (¢) 60 Q.16 Suppose that we store records ona disk device having the following characteristics: ‘Average access motion time : 0.02 sec. Disk rotation speed: 3,000 revolutions per minute Data transfer rate: 250,000 bytes oer sec What isthe expected data transfer time (in sec.) fora randomly accessed physical record thatis ‘500 bytes in length? Q.20 (@) 00212 (b) 0.0230 (0) 0.0240, (@) 00320 Q.17 Which of the following file organization provides very fast access to any arbitary record of a file? (a) Ordered file (©) Unordered file (0) Hashed fle ©) Brie Q.18 Identify the Btree from the following after inserting R. YF X.A, M,C, DE, T,H, VL, G(in the order) with branching factor of IF any insertion of clement causes split, frst spltthat node withoutelement and ater blanced then insert that element. DLR (@) ac] [eron|[ 1vxY a DAT ) aC ero |[ ume] [vv DHR © ac ere |[ um xy az (@) None of these f9 mabe Easy MADE EASY [RESEDr eer 2078] Dems | 53 In a B-Tree, the blook size is 512 bytes, search key is 2 bytes, block pointer size is 6 bytes and record pointer size is 8 bytes. Every node contains n— 1 record pointers, n- 1 search keys, 1 block pointers. Find out the average number of search keys thet can be accommodated ifthe {il factor of B-tree is 67%? @ 0 (b) 21 (©) 31 (d) None ofthese Consider the following B* tree Jssfeolfesi|_] (aEs|99 sslrals) sleasT 60) What will be the resulting B* tree after inserting 80. Assume B* tree incorporate rotation technique. ) Jeshesl et I (oso Basho slave sons] (b) Jesf]eol rol [ssi] © . ESIC Ia (@) None of these Consider the following data A file has 2% records each of size 8 8. One biook of main memory is 1288. Sparse indexing is done with one index record per memory block and one index record is of 1 byte. The blocks stored by the index records are stored in disk. Blocks occupied by index are searched using binary search technique. if on the disk system block read takes 10 m sec, then binary search will take, (@) 1t0msec (b) 120msec (¢) 150msec (@) 180msec ‘Assume a system has the following parameters to construct a B tree: © System block size of 232 bytes, __ Objective Practice sets [J | Computer Science & IT EESEiiered2os] GIMADE EASY * Block pointers are of 12 bytes each Q.25 Consider the following structure of an student * Record pointers are of 12 bytes each record + Index keys are of & bytes each struct studen Find the maximum order of the B+ tree, if the ( intsno; block can contain at most one B+ node in the char sname[22]; system? float marks; @9 (©) 10 char subj[10}; 1 (@) 12 ) ‘Assume integer, character and float data of 2 .23 Which of the folowingis a legal Bree? Assume bytes, 1 byte and 4 bytes respectively. Block minimum branching factors 3. size of 512 bytes is used in unspanned organization and each fle has 500 records. Find the unused space in the last block of a file? (@) 18 bytes (b) 186 bytes (¢) 266 bytes (d) 284 bytes Q.26 What is primary distinction between Bree indices and & tree indices? (2) Btvee eliminates the redundant storage of search-key values (b) B* tree eliminates the redundant storage of search key indices. (©) Deletion ina B-tree is more complicated (d) Lookup in B-tree is proportional to the logarithm of the number of search key Q.27 The record pointer, key field and block pointer of a'B tree are 8B, 108 and 68 respectively. Calculate the order af the tree ifthe block size is 1K (@) (b) 43 (©) 2% (a) None of these @ 0.28 Consider B tee of degree‘ with height Celclatemaximum number recrdsthat can a8) ED Gr beindexedby the above ve assume eats a NX r level’) fa) h-1 (b) €.24 Whatis he “maximum height of Bree,itae an ee tree has n-keys with degree t ‘Note: Node can contain more than one key other 0.29 Suppose we have a block addressable disk drive thonrook with such block organized disk non data : . overhead of sub-blocks andinter-block gaps have @) [oor? | [1ar" | to be accounted for, there are 40,000 bytes per track and the amount of space taken up by sub: blocks and inter-blocks gaps equivalent 10 © [loa 250 bytes per block A ie contains records and (@) | Io" (EGY objective Practice sets ~ GamaAne Ersy wrmaadeeaae G3 MADE EAsY record size is 200 bytes to be stored on the disk. If a total of 32 blocks can be stored per track then what Is the blocking factor? The term "blocking factor’ is used to indicate the number of records that are to the stored in each block in ail. A block is orgnalsed to hold an integral number of logical records, @ 3 (0) 4 @s @ 6 2.30 Choose the correct statements (@) For fixed length records unspanned organization's preterred. (0) For variable length records unspanned organizations preferred. (©) For fixed length records spanned organizationis preferred. (@) None of the above Q.31 Which of the following is not a file operation? (a) FindNext (b) Find (o) Reset (d)_ None of these Q.32 Index sequential ile is made of all of these expect (@)_ primary data (0) overfiowarea (6) hierarchy ofindices (@) address of prime data track torage area Q.33 Which allocation scheme would work best for a file system implemented on a device that can only be accessed sequentially, a tape drive, for instance? (@) Contiguous allocation (©) Non Contiguous allocation (©) Indexed allocation (@) None of the above Q.34 Which statement is false? (@) The leaf nodes of the B* tree are usually linked together to provide ordered access onthe search field to the records, (©) Most implementations of dynamic multilevel index use a variation of the B tree data structure called as Bt tree, (© For a 8 tree constructed on a key, the pointers in internal nodes are tree pointers to blocks that are tree nodes, wwwmadeeasy.in (Made EASY Postal Study Course EXXE| ems | (d) In B* tree, data pointers are stored in the leaf nodes of the tree and the structure of leaf nodes is same as that of the internal Q.35 Which indices search key defines the sequential order of file and which indices search key specifies an order cifferent from sequentialorder of file? (@) Primary, Secondary {b) Clustering, Primary (6) Non-clustering, Secondary (@) Clustering, Secondary Q.36 Which of the following is correct? (a) Btress are for storing data on disk and B* trees are for main memory. (b) Range queries are faster on B* trees. (0) Btrees are for primary indexes and 6" trees are for secondary indexes, (@) The height of a B* tree is independent of the number of records. Q.37 What will be the order (p) of a Bt tree with a database of §,00,000 records of 200 bytes each and the search key is 15 bytes? Assume the tree and data pointers are § bytes each and the index node (data block size) is 1024 bytes (a) 60 (0) 51 (©) to24 @ 6 Q.38 A B tree used as an index for a large databse table has four levels inculding the root node. Ifa new key is inserted in this index, then the maximum number of nodes that could be newly ted inthe process are 4 (2 ) ) Q.39 Given a block can hold either 3 records or 10 key pointers. A database contains n records, then how many blocks do we need to hold the data fle and the dense index. 130 a @ > OF A n oD @ 3 Objective Practice Sets | Computer Science & IT Q.40 Which is the best suitable for sequential access of data (a) Btree (b) B tree (c) both (d)_ None of these Q.41 Consider unspanned blocking with 20 byte blacks. A file contains records of sizes 2, 5, 3, 7, 4, 20 bytes. ‘The percentage of space wasted if blocks are allocated for fle is__. Q.42 Assume that search key size is 90% of the record size within a file (records are fixed length records). Pointer makes up only 10% of he record size, Based on the above assumptions which of the following statements is true? (@) Index block factor >> Database file block factor (b) Database file block factor >> Index block factor {c) Database file block factor = (Index block factor)/2 (@) Database file block factor factor Index block Q.43 The maximum number of records that can be indexed for a B* tree of 4 levels with order 10 and root at level 1 ar Q.44 A file is organized so that the ordering of data record is same as or close to the ordering of data block in some index. Then that index is called (@) Dense (©) Clustered (©) Sparse (@) Unclustered Q.45 Consider a B.tree of order 15 with 3 levels [Root Is at level 1). The maximum possible no of keys Which can be indexed in the above B treeis_. Q.46 The order of an internal nade in a B* tree indexis the maximum number of children it can have. ‘Suppose that a child pointer takes 3 bytes, the search field value takes 17 bytes, and the block size is 1024 bytes. The order ofthe intemal node Postal Study Course PTEE| famape easy [amApe Easy Q.47 The following key values are inserted into a B* - tree in which order ofthe internal nodes is 4, and that ofthe leaf nodes is , in the sequence given below. The order of internal nodes isthe maximum number of tree pointers in each node, and the order of leaf nodes is the maximum number of data items that can be stored init, The B* is initially empty. 3,10, 12, 14, 29, 38, 45, 55, 60, 68 The maximum number of times leaf nodes would get splitup as a result of these insertions is__ Q.48 Consider a Table Twith akey field K. A Btree of order P where P denotes the maximum number of record pointers in a B tree. Assume Kis 12 bytes long, disk block size is 1024 Bytes, record pointer Is 6 bytes and block pointer size is 2 bytes lang. In order for each Btree node to fitin a single disk block the maximum value of P. Q.49 Consider the following statement () Primary index is always sparse (i) Secondary index may or may not be dense Which of the above statement isfare false? (@) Oniy (i) (b) Only (i) (©) Both(#)and (ii) (@) None of these Q.50 The following key values are inserted into an empty &* tree where each node have two key values. Find sum of keys present at height one (assume root is present at height 0) 8.5,1,7,3, 12,9,6 Q.51 A block can hold either 12 records or 24 key pointers. A database contains 96 records, then how many blocks are required to hold the data file and the dense index? (@) 10 () 12 wn (@ 13 .52 Suppose a phone book contain 500 pages and each page can contain upto 500 records. ‘Suppose we want to search fora particular name in a phone book. Give a worst case bound on ‘number of pages that must be looked to perform a search using an index for the name ofthe frst entry of each page. wwwmadeeasy.in MADE EASY Q.53 A data base table T, has 1000 records and ‘occupies 40 disk blocks. Another table T, has 200 records and occupies 10 disk biocks. These two tables have to be joined as por specified join condition that needs to be evaluated for every pair of records from these two tables. The available memory space can accommodate one block of each relations. No index available for any table. ‘The maximum numberof block access required for reading the data if nested loop join is used are ile Organization and Indexing : © 3 @ 4 & 5. 10. ©) 11. © 12 ) 13. @ 14. 19. @) 20. @) 21. () 22 (0) 28. 28. (©) 29. ©) 30. (o) 31. @ 32 37. (b) 38. ) 39. (@ 40. ) 42 10. (c) P x size of tree pointer + (p ~ 1) x (size of key field ) s Block size Since itis B* tree. In order for each BY ree node to fit in a single disk block the maximum value le Organization and Indexing of pis pxP+(p-1)Vs 8 px6+(p-1)x9 < 512 18p < 521 pss 11. (©) ‘Typical structure of a Bree non-leaf node is follows ATS TS [& [Re] [Po] Bena [Ro |Pa] in order for each B-tree node to fit in a single disk biock the maximum value of pis. (px P) + ((p- 1) x (p,+ Ws B wwnmadeeasy.in Postal Study Course BTJE| (mabe Easy Dems | 57 Q.54 Considerarelation Rwith 6 attributes A,, A,. As, Ay Ag: Ay. Given the following FD's Ay Ay AgAy > Ag AsAs > AgAy ‘The number of candidate keys that includes A, as attributes Q.56 In a database file, the search field is 8 bytes long the biock size is 512 bytes, Srecord pointer is 7 bytes and block pointer is 6 bytes. The largest possible order of a non leaf node in B* tree implementing this file structure? OUGOw OG oO a @ @ 1% @ 16 @ 17, © 18 © (0) 24. (@) 25. () 26. () 27. (0) (33. (6) 34 (@ 35. () 36. (6) () 44. (b) 49. ©) 51. (@) where disk block size 8 = 512 byte block pointer p = 58 record (data pointer) P = 88 search field Kor ¥ = 108 (0x5) + ((p-1) x (8+ 10) $812 5p + 189-18 < 512 23p < 512418 12. (b) One level B* tree node will have 512 index entries which could only refer to 512 pages. A two level B* tree will have $12? index entries at the leaf level. There are 262,144 entries. This is enough toaddress the 1000 pages of the file. Moreover, sufficient to address each record individually, since there are only 100,000 records. chaneaaeee | Computer Science & IT 14. (a) B+ tree incorporate rotation technique. Insertion of 80 would be done between 60 and 85. But in the node between 60 and 85, there is no space and also the child node of 85 and above, has no space left. So due to rotation technique, 60 will be inserted into the child node of 35 and 60. 65 will be shifted upwards and thus 80 will be inserted. So the tree wil ook like: eI] [e5[s0T es [10g (ss[70I75[s0] 15. 95’ will be inserted in node (757607S5[80]. but the node is full According to the properties given in que, the rTiddle element ofthe node will be placed in next (higher index while spiiting. So, in 75 80 85 90 95, 85 willbe placed upwards Now, in above index, the node is full, so again need to split up. 60 is middle element, soit wll goto upper layer! root index. So tree wil be: eee 2018) Ga made EASY 16. (d) Average Access Time = Seek Time + Average Rotational Delay + Data Transfer Time ‘Seek Time = 0.02 (given) oo 4 ‘Average Rotational Delay = 29> x 3 =0.01 Date Transfer Time= 500/250000 = 0,002 So Access Time = 0.02 + 0.01 + 0.02 = 0.320 17. () Hashed file can be accessed with O(1) ‘complexity, 18. (c) CESSES ©8 19. (a) Ifill factor is 67% so 32x52 = 21.44 = 21 100 So 21 block pointers Number of keys = Number of block pointers - 1 20 keys. ie, (21-1) = 20. (a) wes a est Seo a 88 703 (Sofiia ee a) (B]zs(30y_] ay Sorted order 60, 65, 70, 75, 80 as left leaf has Eh orecve acca sete ‘space, so we can do redistribution, Wg mADE EASY wwmmadeeasyin MADE EASY 80 a | — (i520.2830) (6538-2050) 21. (a) ‘one block read takes 10 msec. 18 blocks read takes 18 x 10 = 180 msec. 22. (c) 25, # keys (Index keysize + block pointer size) + Record pointer size s Blocksize = (B+ 12)+ 125282 > nst Maximum order = 11 23. (b) () Allleats are not at same level (not balanced), Itis not B-tree. 27. (b) Root canhave 1 key and remaining contains minimum 2 keys. Hence it is B-ree. (¢) "4" key has less than allowable size. (Minimum 2 keys) (0) Right to 7, there is no key. 24. (d) At ‘rodos Ahoy nog 28. \ inet s aya eS ee XC? Maxheightis possibleif every node has minimum 29 keys. Foot can contain minimum key Other nodes can contain minimum (t- 1) keys. 214 2(t-1) + 2Kt-1) + 2A (t-1) +. + 2t"(t~1) 2142-9 wwwmadeeasyin MADE Easy Postal Study Course EXIE] pews | > weou-1(2=!) net 42(0-1) > 2-2 7 aa = ne login"? = the bod] (d) Number of blocks required fora file [_s00 records « [isteoosspecr] = 29 39 blocks required for 500 records and each block occupied by 13 records. 39x 13-500 = 7 records space isnot used for fle, The last block holds only 6 records for file and remaining space is wasted 2.8126 x 98 = 284 bytes of space unused. (b) nBp+(n- 1) keys{n-1) record pointer < 1024 B x6 +(n-1)x10+(n-1)xB< 1024 6n+10n+8n-18< 1024 24 n< 10244 18 042 24 ns 43.413 (c) At level’, the number of records At level, the number of record: At level 'h' the number of records Total = (n= 1)(1 + n+ + a) =o} oF ne = 43. n-1) ma~1) (c) Number of blocks per trac Number of bytes per track = 40000 bytes 40000 32 =: Number of bytes per block = 1250 bytes Space taken by sub:blocks and inter blocks gap = 250 bytes Objective Practice Sets | Computer Science & IT Soremaining 1250-250 = 1000 bytes are used for records, =. record size = 200 bytes 1000 Number of records per block = 1200 _ lumber of records per block = 47> =5 39. (a) Forstoring the records number of blocks required = end for storing the keys in dense index umber of blocks required = +7 So total blocks required = 41. (31.68) 2.5.37 4 20 [ = Boje ———— oe a De ‘Space wasted =3 + 16 = 19 % of space wasted = 12x 100 = 91.66% 42. (d) Its given that key size + Record pointer size = Record size This makes [es eat | Key +Record pointer = Index block factor = | Becks size— Header Record size = Database file block factor 43. (9000) In level 2 there will be 10 nodes as order is 10, In level 8 there will be 10 x 10 In level 4 there willbe 10 x 100 = 1000 nodes Atlevel 4 each node will have 9 record pointers. So, therefore the maximum number of records that be indexed are 1000 x 9 = 9000. 44, (b) + Insparse index numberof entries depends oon number of data block in previous level + Indense index number of entries depends ‘on number of data record in previous level. (FF obicctive Practice sets (amane easy Postal Study Course EEE] MADE ERSY 45. (3374) LevelO Level Level 2 u L L 144 15x 144 1815 1423374 46. (52) Size of child pointer = 3 byte Size of search field value takes 17 bytes Block size = 1024 ‘The order of intemalnode = P (Number of block pointers in any node) = (P-1)17 +P "3 $1024 17P43P-17 = 1024 20P < 1024417 P's 1061/20 = [205]=52 47. (4) ‘No. of key in internal node = 3 .¢, [4 No.of key in leaf node = 3. order = # Key] Insert 3, 10, 12: ; “ EEE] -- = Insert 14, 29: 7 2 Le [#2 Seovariw o-—| = 12 |} 29 3 || 0 12 || 10 || || 29 Insert 38, 45: 2 jel] fell owiwen —| =e le] Iel=i=l= MADE EASY ERAN 2075] pems | 52. (2) If the book were organized as a heap file in a linear search so worst case bound is 500. By sing binary search the worst case bound is flog, 500]=9 using the fact that the book is ordered by names with an index for the name of the frst entry on each page we get worst case bound is 2 because the index has 500 pages. s0 entire index les in one page 1 access tothe index and 1 to the data. 53. (10040) Innested loop join for each records in table 1 all records of table 2 are loaded So, two choice 4, T,as outer table So the maximum number of splits of leaf node isa (1000 x 10) + 40 = 10040 48. (51) 2, Tyas outer table (12 +6)P+ (P+ 1)-2 5 1024 (200 x 40) + 20 = 8020 1eP+2P +2 s 1024 ‘ 54. (1) PoP 1022 Ce ssi : 7 Soadd A, - (AAAI > ArAaAte Ar (1) 49. (c) (A, Ag)” > Ay As Aa As Primary index may er may not be sparse. So add Ay Secondary index is always dense. (AAD > AA AAs AcAs (2) (AyAd* > Ass 50. (18) add Ay (AAGAY > AyAg AAAs As (2) Three candidate keys are (A, Ay Ae) (Ay As Ae) = and (A,A,A)inwhich one candidate key contain te fra Sad = ss. (4 Order of 8 tree for non leaf nade = Number of 51. (c) block pointers To store the records, the number of blocks (1) Key + Pe Block pointer $612 < needed = 2 =8 (P-1)#8+P#7 S512 : ‘To store the keys in dense index, the numiber of 15P<820 | 96 520 Ks needed = 3 p= |222|=34 blooks needed = 57 { = ‘otal number of blocks required = 8 +4 wwnmadeeasy.n (jmave Easy

You might also like