GATE 2005 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2005

203 questions

MCQ 2031-mark 203

Questions 161–165 of 203

Q161Relational Algebra1 markMCQ−0.33 if wrong
Let r be a relation instance with schema R = (A, B, C, D). We define r1=ΠA,B,C(R)r_{1}=\Pi _{A,B,C}(R) and r2=ΠA,D(R)r_{2}=\Pi _{A,D}(R). Let s=r1∗r2s=r_1*r_2 where * denotes natural join. Given that the decomposition of r into r1r_1 and r2r_2 is lossy, which one of the following is TRUE?

Q162Relational Algebra1 markMCQ−0.33 if wrong
A database table T1T_1 has 2000 records and occupies 80 disk blocks. Another table T2T_2 has 400 records and occupies 20 disk blocks. These two tables have to be joined as per a specified join condition that needs to be evaluated for every pair of records from these two tables. The memory buffer space available can hold exactly one block of records for T1T_1 and one block of records for T2T_2 simultaneously at any point in time. No index is available on either table.
If, instead of Nested-loop join, Block nested-loop join is used, again with the most appropriate choice of table in the outer loop, the reduction in number of block accesses required for reading the data will be

Q163Relational Algebra1 markMCQ−0.33 if wrong
A database table T1T_1 has 2000 records and occupies 80 disk blocks. Another table T2T_2 has 400 records and occupies 20 disk blocks. These two tables have to be joined as per a specified join condition that needs to be evaluated for every pair of records from these two tables. The memory buffer space available can hold exactly one block of records for T1T_1 and one block of records for T2T_2 simultaneously at any point in time. No index is available on either table.
If 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 accesses required for reading the data are

Q164SQL1 markMCQ−0.33 if wrong
In an inventory management system implemented at a trading corporation, there are several tables designed to hold all the information. Amongst these, the following two tables hold information on which items are supplied by which suppliers, and which warehouse keeps which items along with the stock-level of these items.
Supply = (supplierid, itemcode)
Inventory = (itemcode, warehouse, stocklevel)
For a specific information required by the management, following SQL query has been written
 Select distinct STMP.supplierid 
From Supply as STMP
Where not unique (Select ITMP.supplierid
                            From Inventory, Supply as ITMP
                            Where STMP.supplierid = ITMP.supplierid
                            And ITMP.itemcode = Inventory.itemcode
                            And Inventory.warehouse = 'Nagpur');

For the warehouse at Nagpur, this query will find all suppliers wh

Q165SQL1 markMCQ−0.33 if wrong
A table 'student' with schema (roll, name, hostel, marks), and another table 'hobby' with schema (roll, hobbyname) contains records as shown below:
RollNameHostelMarks1798Manoj Rathor7952154Soumic Banerjee5682369Gumma Reddy7862581Pradeep pendse6922643Suhas Kulkarni5782711Nitin Kadam8722872Kiran Vora5922926Manoj Kunkalikar5942959Hemant Karkhanis7883125Rajesh Doshi582Table: student\overset{\text{Table: student}}{\begin{array}{|c|c|c|c|} \hline \textbf{Roll} & \textbf {Name} & \textbf {Hostel} & \textbf{Marks} \\\hline \text{1798} & \text{Manoj Rathor} & \text{7} & \text{95} \\\hline \text{2154} & \text{Soumic Banerjee} & \text{5} & \text{68}\\\hline \text{2369} & \text{Gumma Reddy} & \text{7} & \text{86}\\\hline\text{2581} & \text{Pradeep pendse} & \text{6} & \text{92}\\\hline \text{2643} & \text{Suhas Kulkarni} & \text{5} & \text{78} \\\hline \text{2711} & \text{Nitin Kadam} & \text{8} & \text{72}\\\hline \text{2872}& \text{Kiran Vora} & \text{5} & \text{92}\\\hline\text{2926} & \text{Manoj Kunkalikar} & \text{5} & \text{94}\\\hline \text{2959}& \text{Hemant Karkhanis} & \text{7} & \text{88}\\\hline\text{3125} & \text{Rajesh Doshi} & \text{5} & \text{82}\\\hline \end{array}}

Table: hobbyRollHobby Name1798chess1798music2154music2369swimming2581cricket2643chess2643hockey2711volleyball2872football2926cricket2959photography3125music3125chess\overset{\text{Table: hobby}}{}\\\begin{array}{|c|c|} \hline \textbf{Roll} & \textbf {Hobby Name} \\\hline \text{1798} & \text{chess} \\\hline \text{1798} & \text{music} \\\hline \text{2154} & \text{music} \\\hline \text{2369} & \text{swimming}\\\hline \text{2581} & \text{cricket} \\\hline \text{2643} & \text{chess}\\\hline\text{2643} & \text{hockey} \\\hline \text{2711} & \text{volleyball}\\\hline \text{2872} & \text{football} \\\hline \text{2926} & \text{cricket} \\\hline \text{2959} & \text{photography} \\\hline \text{3125} & \text{music}\\\hline \text{3125}& \text{chess}\\\hline \end{array}
The following SQL query is executed on the above tables:
 
select hostel
from student natural join hobby
where marks >= 75 and roll between 2000 and 3000;

Relations S and H with the same schema as those of these two tables respectively contain the same information as tuples. A new relation S is obtained by the following relational algebra operation:
S′=Πhostel((σs.roll=H.roll(σmarks>75 and roll>2000 and roll<3000(S))×(H))S' = \Pi_{\text{hostel}} ((\sigma_{s.roll = H.roll} (\sigma_{marks \gt 75\text{ and }roll \gt 2000\text{ and }roll \lt 3000} (S)) \times (H))
The difference between the number of rows output by the SQL statement and the number of tuples in S' is