Databases questions — page 3 of 6

Q23

GATE CS 2021 CS-1Relational QueriesNAT1 mark
A relation r(A,B)r(A, B) in a relational database has 1200 tuples. The attribute AA has integer values ranging from 6 to 20, and the attribute BB has integer values ranging from 1 to 20. Assume that the attributes AA and BB are independently distributed.
The estimated number of tuples in the output of σ(A>10)∨(B=18)(r)\sigma_{(A>10) \vee (B=18)}(r) is ______.
Show answer without attempting

Answer: 819 to 820 OR 205

Q27

GATE CS 2021 CS-1Relational QueriesMCQ2 marks−2/3 if wrong
The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:
empAge(empNo‾,age)empAge(\underline{empNo}, age)
Consider the following relational algebra expression:
ΠempNo(empAge⋈(age>age1)ρempNo1, age1(empAge))\Pi_{empNo}\left(empAge \bowtie_{(age > age1)} \rho_{empNo1,\, age1}(empAge)\right)
What does the above expression generate?
Show answer without attempting

Answer: C

Q32

GATE CS 2021 CS-1TransactionsMCQ2 marks−2/3 if wrong
Let ri(z)r_i(z) and wi(z)w_i(z) denote read and write operations respectively on a data item zz by a transaction TiT_i. Consider the following two schedules.
S1S_1: r1(x) r1(y) r2(x) r2(y) w2(y) w1(x)r_1(x)\ r_1(y)\ r_2(x)\ r_2(y)\ w_2(y)\ w_1(x)
S2S_2: r1(x) r2(x) r2(y) w2(y) r1(y) w1(x)r_1(x)\ r_2(x)\ r_2(y)\ w_2(y)\ r_1(y)\ w_1(x)
Which one of the following options is correct?
Show answer without attempting

Answer: B

Q33

GATE CS 2021 CS-1Relational DesignMCQ2 marks−2/3 if wrong
Consider the relation R(P,Q,S,T,X,Y,Z,W)R(P, Q, S, T, X, Y, Z, W) with the following functional dependencies.
PQ→X; P→YX; Q→Y; Y→ZWPQ \to X;\ P \to YX;\ Q \to Y;\ Y \to ZW
Consider the decomposition of the relation RR into the constituent relations according to the following two decomposition schemes.
D1D_1: R=[(P,Q,S,T); (P,T,X); (Q,Y); (Y,Z,W)]R = [(P, Q, S, T);\ (P, T, X);\ (Q, Y);\ (Y, Z, W)]
D2D_2: R=[(P,Q,S); (T,X); (Q,Y); (Y,Z,W)]R = [(P, Q, S);\ (T, X);\ (Q, Y);\ (Y, Z, W)]
Which one of the following options is correct?
Show answer without attempting

Answer: A

Q6

GATE CS 2021 CS-2Data ModelsMCQ1 mark−1/3 if wrong
Consider the following statements S1 and S2 about the relational data model:

S1: A relation scheme can have at most one foreign key.
S2: A foreign key in a relation scheme R cannot be used to refer to tuples of R.

Which one of the following choices is correct?
Show answer without attempting

Answer: D

Q21

GATE CS 2021 CS-2Storage and IndexingNAT1 mark
A data file consisting of 1,50,000 student-records is stored on a hard disk with block size of 4096 bytes. The data file is sorted on the primary key RollNo. The size of a record pointer for this disk is 7 bytes. Each student-record has a candidate key attribute called ANum of size 12 bytes. Suppose an index file with records consisting of two fields, ANum value and the record pointer to the corresponding student record, is built and stored on the same disk. Assume that the records of data file and index file are not split across disk blocks. The number of blocks in the index file is ____________.
Show answer without attempting

Answer: 698

Q31

GATE CS 2021 CS-2Relational QueriesMCQ2 marks−2/3 if wrong
The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.

emp(empId‾\underline{\text{empId}}, name, gender, salary, deptId)

Consider the following SQL query:
select deptId, count(*)
from emp
where gender = "female" and salary > (select avg(salary) from emp)
group by deptId;
The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of
Show answer without attempting

Answer: B

Q32

GATE CS 2021 CS-2TransactionsMCQ2 marks−2/3 if wrong
Let SS be the following schedule of operations of three transactions T1T_1, T2T_2 and T3T_3 in a relational database system:

R2(Y),R1(X),R3(Z),R1(Y),W1(X),R2(Z),W2(Y),R3(X),W3(Z)R_2(Y), R_1(X), R_3(Z), R_1(Y), W_1(X), R_2(Z), W_2(Y), R_3(X), W_3(Z)

Consider the statements P and Q below:

P: SS is conflict-serializable.
Q: If T3T_3 commits before T1T_1 finishes, then SS is recoverable.

Which one of the following choices is correct?
Show answer without attempting

Answer: B

Q40

GATE CS 2021 CS-2Relational DesignMSQ2 marks
Suppose the following functional dependencies hold on a relation U with attributes P,Q,R,SP, Q, R, S, and TT:

<br>P→QR<br>RS→T<br>\begin{aligned}<br>P & \to QR \\<br>RS & \to T<br>\end{aligned}

Which of the following functional dependencies can be inferred from the above functional dependencies?
More than one option can be correct.
Show answer without attempting

Answer: A, C, D

Q13

GATE CS 2020 CSRelational QueriesMCQ1 mark−1/3 if wrong
Consider a relational database containing the following schemas (the tables Catalogue, Suppliers and Parts are shown in the figure).

The primary key of each table is indicated by underlining the constituent fields.
SELECT s.sno, s.sname
FROM   Suppliers s, Catalogue c
WHERE  s.sno = c.sno AND
       cost > (SELECT AVG (cost)
               FROM Catalogue
               WHERE pno = 'P4'
               GROUP BY pno);
The number of rows returned by the above SQL query is
Question figure
Show answer without attempting

Answer: A

Q14

GATE CS 2020 CSData ModelsMCQ1 mark−1/3 if wrong
Which one of the following is used to represent the supporting many-one relationships of a weak entity set in an entity-relationship diagram?
Show answer without attempting

Answer: A

Q36

GATE CS 2020 CSRelational DesignMCQ2 marks−2/3 if wrong
Consider a relational table RR that is in 3NF, but not in BCNF. Which one of the following statements is TRUE?
Show answer without attempting

Answer: A

Q37

GATE CS 2020 CSTransactionsMCQ2 marks−2/3 if wrong
Consider a schedule of transactions T1T_1 and T2T_2 (shown in the figure).

Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one of the following schedules is conflict equivalent to the above schedule?
Question figure
Show answer without attempting

Answer: A

Q54

GATE CS 2020 CSStorage and IndexingNAT2 marks
Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database is __________.
Show answer without attempting

Answer: 4

Q11

GATE CS 2019 CSTransactionsMCQ1 mark−1/3 if wrong
Consider the following two statements about database transaction schedules:
I. Strict two-phase locking protocol generates conflict serializable schedules that are also recoverable.
II. Timestamp-ordering concurrency control protocol with Thomas' Write Rule can generate view serializable schedules that are not conflict serializable.

Which of the above statements is/are TRUE?
Show answer without attempting

Answer: C

Q14

GATE CS 2019 CSStorage and IndexingMCQ1 mark−1/3 if wrong
Which one of the following statements is NOT correct about the B+ tree data structure used for creating an index of a relational database table?
Show answer without attempting

Answer: B

Q32

GATE CS 2019 CSRelational DesignMCQ2 marks−2/3 if wrong
Let the set of functional dependencies F={QR→S,R→P,S→Q}F = \{QR \to S, R \to P, S \to Q\} hold on a relation schema X=(PQRS)X = (PQRS). XX is not in BCNF. Suppose XX is decomposed into two schemas YY and ZZ, where Y=(PR)Y = (PR) and Z=(QRS)Z = (QRS).

Consider the two statements given below.
I. \quad Both YY and ZZ are in BCNF
II. \quad Decomposition of XX into YY and ZZ is dependency preserving and lossless

Which of the above statements is/are correct?
Show answer without attempting

Answer: C

Q51

GATE CS 2019 CSRelational QueriesNAT2 marks
A relational database contains two tables Student and Performance as shown below:

Student
Roll_no.Student_name
1Amit
2Priya
3Vinit
4Rohan
5Smita
Performance
Roll_no.Subject_codeMarks
1A86
1B95
1C90
2A89
2C92
3C80
The primary key of the Student table is Roll_no. For the Performance table, the columns Roll_no. and Subject_code together form the primary key. Consider the SQL query given below:
SELECT S.Student_name, sum(P.Marks)
FROM Student S, Performance P
WHERE P.Marks > 84
GROUP BY S.Student_name;
The number of rows returned by the above SQL query is __________.
Show answer without attempting

Answer: 5

Q55

GATE CS 2019 CSRelational QueriesNAT2 marks
Consider the following relations P(X, Y, Z), Q(X, Y, T) and R(Y, V).

P
XYZ
X1Y1Z1
X1Y1Z2
X2Y2Z2
X2Y4Z4
Q
XYT
X2Y12
X1Y25
X1Y16
X3Y31
R
YV
Y1V1
Y3V2
Y2V3
Y2V2
How many tuples will be returned by the following relational algebra query?
∏X(σ(P.Y=R.Y∧R.V=V2)(P×R))−∏X(σ(Q.Y=R.Y∧Q.T>2)(Q×R))\prod_X \left(\sigma_{(P.Y = R.Y \land R.V = V2)}(P \times R)\right) - \prod_X \left(\sigma_{(Q.Y = R.Y \land Q.T > 2)}(Q \times R)\right)
Answer: __________.
Show answer without attempting

Answer: 1

Q11

GATE CS 2018 CSData ModelsMCQ1 mark−1/3 if wrong
In an Entity-Relationship (ER) model, suppose RR is a many-to-one relationship from entity set E1 to entity set E2. Assume that E1 and E2 participate totally in RR and that the cardinality of E1 is greater than the cardinality of E2.

Which one of the following is true about RR?
Show answer without attempting

Answer: A

0/200 correct0 marks

Related topics in GATE CS