Databases questions — page 5 of 6

Q52

GATE CS 2016 CS-2Relational QueriesNAT2 marks
Consider the following database table named water_schemes :
scheme_nodistrict_namecapacity
1Ajmer20
1Bikaner10
2Bikaner10
3Bikaner20
1Churu10
2Churu20
1Dungargarh10
The number of tuples returned by the following SQL query is _________.
with total(name, capacity) as
    select district_name, sum(capacity)
    from water_schemes
    group by district_name
with total_avg(capacity) as
    select avg(capacity)
    from total
select name
    from total, total_avg
    where total.capacity ≥ total_avg.capacity
Show answer without attempting

Answer: 2.0

Q13

GATE CS 2015 CS-3Relational DesignMCQ1 mark−1/3 if wrong
Consider the relation X(P,Q,R,S,T,U)X(P, Q, R, S, T, U) with the following set of functional dependencies

F={{P,R}→{S,T},{P,S,U}→{Q,R}}F = \{\{P, R\} \to \{S, T\}, \{P, S, U\} \to \{Q, R\}\}

Which of the following is the trivial functional dependency in F+F^+, where F+F^+ is closure of FF ?
Show answer without attempting

Answer: C

Q29

GATE CS 2015 CS-3Relational QueriesMCQ1 mark−1/3 if wrong
Consider the following relation

Cinema(theater, address, capacity)

Which of the following options will be needed at the end of the SQL query
SELECT P1.address
FROM Cinema P1
such that it always finds the addresses of theaters with maximum capacity?
Show answer without attempting

Answer: A

Q39

GATE CS 2015 CS-3Storage and IndexingNAT2 marks
Consider a B+ tree in which the search key is 12 bytes long, block size is 1024 bytes, record pointer is 10 bytes long and block pointer is 8 bytes long. The maximum number of keys that can be accommodated in each non-leaf node of the tree is ____________.
Show answer without attempting

Answer: 50

Q51

GATE CS 2015 CS-3TransactionsMCQ2 marks−2/3 if wrong
Consider the following partial Schedule SS involving two transactions T1T1 and T2T2. Only the read and the write operations have been shown. The read operation on data item PP is denoted by read(P) and the write operation on data item PP is denoted by write(P).
Time instanceT1T2
1read(A)
2write(A)
3read(C)
4write(C)
5read(B)
6write(B)
7read(A)
8commit
9read(B)
Schedule S

Suppose that the transaction T1T1 fails immediately after time instance 9. Which one of the following statements is correct?
Show answer without attempting

Answer: B

Q31

GATE CS 2015 CS-1Relational QueriesMCQ1 mark−1/3 if wrong
SELECT operation in SQL is equivalent to
Show answer without attempting

Answer: D

Q32

GATE CS 2015 CS-1Storage and IndexingMCQ1 mark−1/3 if wrong
A file is organized so that the ordering of data records is the same as or close to the ordering of data entries in some index. Then that index is called
Show answer without attempting

Answer: C

Q48

GATE CS 2015 CS-1Data ModelsNAT2 marks
Consider an Entity-Relationship (ER) model in which entity sets E1E_1 and E2E_2 are connected by an m:nm : n relationship R12R_{12}. E1E_1 and E3E_3 are connected by a 1:n1 : n (1 on the side of E1E_1 and nn on the side of E3E_3) relationship R13R_{13}.

E1E_1 has two single-valued attributes a11a_{11} and a12a_{12} of which a11a_{11} is the key attribute. E2E_2 has two single-valued attributes a21a_{21} and a22a_{22} of which a21a_{21} is the key attribute. E3E_3 has two single-valued attributes a31a_{31} and a32a_{32} of which a31a_{31} is the key attribute. The relationships do not have any attributes.

If a relational model is derived from the above ER model, then the minimum number of relations that would be generated if all the relations are in 3NF is ________.
Show answer without attempting

Answer: 4

Q61

GATE CS 2015 CS-1Relational QueriesNAT2 marks
Consider the following relations:

Student
Roll_NoStudent_Name
1Raj
2Rohit
3Raj
Performance
Roll_NoCourseMarks
1Math80
1English70
2Math75
3English80
2Physics65
3Math80
Consider the following SQL query.
SELECT S.Student_Name, sum(P.Marks)
FROM Student S, Performance P
WHERE S.Roll_No = P.Roll_No
GROUP BY S.Student_Name
The number of rows that will be returned by the SQL query is ________.
Show answer without attempting

Answer: 2

Q31

GATE CS 2015 CS-2TransactionsMCQ1 mark−1/3 if wrong
Consider the following transaction involving two bank accounts x and y.
read(x); x := x - 50; write(x); read(y); y:= y + 50; write(y)
The constraint that the sum of the accounts x and y should remain constant is that of
Show answer without attempting

Answer: B

Q32

GATE CS 2015 CS-2Storage and IndexingNAT1 mark
With reference to the B+ tree index of order 1 shown below, the minimum number of nodes (including the Root node) that must be fetched in order to satisfy the following query: "Get all records with a search key greater than or equal to 7 and less than 15" is ____________.
Question figure
Show answer without attempting

Answer: 5

Q39

GATE CS 2015 CS-2TransactionsMCQ2 marks−2/3 if wrong
Consider a simple checkpointing protocol and the following set of operations in the log.

(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2);

If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?
Show answer without attempting

Answer: A

Q40

GATE CS 2015 CS-2Relational QueriesMCQ2 marks−2/3 if wrong
Consider two relations R1(A,B)R_1(A,B) with the tuples (1,5), (3,7) and R2(A,C)R_2(A,C) = (1,7), (4,9). Assume that R(A,B,C) is the full natural outer join of R1R_1 and R2R_2. Consider the following tuples of the form (A,B,C): a = (1,5,null), b = (1,null,7), c = (3,null,9), d = (4,7,null), e = (1,5,7), f = (3,7,null), g = (4,null,9). Which one of the following statements is correct?
Show answer without attempting

Answer: C

Q21

GATE CS 2014 CS-2Relational DesignNAT1 mark
The maximum number of superkeys for the relation schema R(E,F,G,H) with E as the key is _____.
Show answer without attempting

Answer: 8

Q22

GATE CS 2014 CS-2Relational DesignNAT1 mark
Given an instance of the STUDENTS relation as shown below:
StudentIDStudentNameStudentEmailStudentAgeCPI
2345Shankarshankar@mathX9.4
1287Swatiswati@ee199.5
7853Shankarshankar@cse199.4
9876Swatiswati@mech189.3
8765Ganeshganesh@civil198.7
For (StudentName, StudentAge) to be a key for this instance, the value X should NOT be equal to _______________.
Show answer without attempting

Answer: 19

Q29

GATE CS 2014 CS-2TransactionsMCQ2 marks−2/3 if wrong
Consider the following schedule S of transactions T1, T2, T3, T4:
T1T2T3T4
Reads(X)
Writes(X)
Commit
Writes(X)
Commit
Writes(Y)
Reads(Z)
Commit
Reads(X)
Reads(Y)
Commit
Which one of the following statements is CORRECT?
Show answer without attempting

Answer: C

Q30

GATE CS 2014 CS-2Relational QueriesMCQ2 marks−2/3 if wrong
Consider a join (relation algebra) between relations r(R) and s(S) using the nested loop method. There are 3 buffers each of size equal to disk block size, out of which one buffer is reserved for intermediate results. Assuming size(r(R)) < size(s(S)), the join will have fewer number of disk block accesses if
Show answer without attempting

Answer: A

Q54

GATE CS 2014 CS-2Relational QueriesMCQ2 marks−2/3 if wrong
SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same answer as the nested query shown below:
select * from R where a in (select S.a from S)
Show answer without attempting

Answer: C

Q19

GATE CS 2014 CS-3Relational DesignMCQ1 mark−1/3 if wrong
In the context of modular software design, which one of the following combinations is desirable?
Show answer without attempting

Answer: B

Q21

GATE CS 2014 CS-3Relational QueriesMCQ1 mark−1/3 if wrong
What is the optimized version of the relation algebra expression πA1(πA2(σF1(σF2(r))))\pi_{A1}(\pi_{A2}(\sigma_{F1}(\sigma_{F2}(r)))) where A1,A2A1, A2 are sets of attributes in rr with A1⊂A2A1 \subset A2 and F1,F2F1, F2 are Boolean expressions based on the attributes in rr?
Show answer without attempting

Answer: A

0/200 correct0 marks

Related topics in GATE CS