Databases questions

Q13

GATE CS 2021 CS-1TransactionsMSQ1 mark
Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the transactions or during recovery.
Which of the following statements is/are correct?
More than one option can be correct.
Show answer without attempting

Answer: A

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

0/100 correct0 marks

Related topics in GATE CS