Databases questions

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

Q22

GATE CS 2014 CS-3Relational DesignMCQ1 mark−1/3 if wrong
A prime attribute of a relation scheme RR is an attribute that appears
Show answer without attempting

Answer: B

Q29

GATE CS 2014 CS-3TransactionsMCQ2 marks−2/3 if wrong
Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below.

T1: r1(X); r1(Z); w1(X); w1(Z)
T2: r2(Y); r2(Z); w2(Z)
T3: r3(Y); r3(X); w3(Y)

S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)

Which one of the following statements about the schedules is TRUE?
Show answer without attempting

Answer: A

Q30

GATE CS 2014 CS-3Relational QueriesMCQ2 marks−2/3 if wrong
Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation.

employee (empId, empName, empAge)
dependent(depId, eId, depName, depAge)

Consider the following relational algebra query:

ΠempId(employee)−ΠempId(employee⋈(empId=eID)∧(empAge≤depAge)dependent)\Pi_{empId}(\text{employee}) - \Pi_{empId}(\text{employee} \bowtie_{(\text{empId} = \text{eID}) \land (\text{empAge} \le \text{depAge})} \text{dependent})

The above query evaluates to the set of empIds of employees whose age is greater than that of
Show answer without attempting

Answer: D

Q54

GATE CS 2014 CS-3Relational QueriesMCQ2 marks−2/3 if wrong
Consider the following relational schema:

employee(empId,empName,empDept)
customer(custId,custName,salesRepId,rating)

salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return?
SELECT empName
FROM employee E
WHERE NOT EXISTS (SELECT custId
                  FROM customer C
                  WHERE C.salesRepId = E.empId
                  AND C.rating <> 'GOOD');
Show answer without attempting

Answer: D

Q21

GATE CS 2014 CS-1Relational DesignMCQ1 mark−1/3 if wrong
Consider the relation scheme R=(E,F,G,H,I,J,K,L,M,N)R = (E, F, G, H, I, J, K, L, M, N) and the set of functional dependencies {{E,F}→{G},{F}→{I,J},{E,H}→{K,L},{K}→{M},{L}→{N}}\{\{E, F\} \to \{G\}, \{F\} \to \{I, J\}, \{E, H\} \to \{K, L\}, \{K\} \to \{M\}, \{L\} \to \{N\}\} on RR. What is the key for RR?
Show answer without attempting

Answer: B

Q22

GATE CS 2014 CS-1Relational DesignMCQ1 mark−1/3 if wrong
Given the following statements:

S1: A foreign key declaration can always be replaced by an equivalent check assertion in SQL.

S2: Given the table R(a,b,c) where a and b together form the primary key, the following is a valid table definition.
CREATE TABLE S (
  a INTEGER,
  d INTEGER,
  e INTEGER,
  PRIMARY KEY (d),
  FOREIGN KEY (a) references R
)
Which one of the following statements is CORRECT?
Show answer without attempting

Answer: D

Q29

GATE CS 2014 CS-1TransactionsMCQ2 marks−2/3 if wrong
Consider the following four schedules due to three transactions (indicated by the subscript) using read and write on a data item xx, denoted by r(x)r(x) and w(x)w(x) respectively. Which one of them is conflict serializable?
Show answer without attempting

Answer: D

Q30

GATE CS 2014 CS-1Relational DesignMCQ2 marks−2/3 if wrong
Given the following two statements:

S1: Every table with two single-valued attributes is in 1NF, 2NF, 3NF and BCNF.
S2: AB→C,D→E,E→CAB \to C, D \to E, E \to C is a minimal cover for the set of functional dependencies AB→C,D→E,AB→E,E→CAB \to C, D \to E, AB \to E, E \to C.

Which one of the following is CORRECT?
Show answer without attempting

Answer: A

Q54

GATE CS 2014 CS-1Relational QueriesMCQ2 marks−2/3 if wrong
Given the following schema:
employees(emp-id, first-name, last-name, hire-date, dept-id, salary)
departments(dept-id, dept-name, manager-id, location-id)
You want to display the last names and hire dates of all latest hires in their respective departments in the location ID 1700. You issue the following query:
SQL>SELECT last-name, hire-date
 FROM employees
 WHERE (dept-id, hire-date) IN
 (SELECT dept-id, MAX(hire-date)
 FROM employees JOIN departments USING(dept-id)
 WHERE location-id = 1700
 GROUP BY dept-id);
What is the outcome?
Show answer without attempting

Answer: B

0/160 correct0 marks

Related topics in GATE CS