Databases questions — page 6 of 6

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

Q15

GATE CS 2013 CSStorage and IndexingMCQ1 mark−1/3 if wrong
An index is clustered, if
Show answer without attempting

Answer: C

Q35

GATE CS 2013 CSRelational QueriesMCQ2 marks−2/3 if wrong
Consider the following relational schema.

Students(rollno: integer‾\underline{\text{rollno: integer}}, sname: string)
Courses(courseno: integer‾\underline{\text{courseno: integer}}, cname: string)
Registration(rollno: integer, courseno: integer‾\underline{\text{rollno: integer, courseno: integer}}, percent: real)

Which of the following queries are equivalent to this query in English?
"Find the distinct names of all students who score more than 90% in the course numbered 107"

(I) SELECT DISTINCT S.sname
FROM Students as S, Registration as R
WHERE R.rollno=S.rollno AND R.courseno=107 AND R.percent > 90
(II) Πsname(σcourseno=107∧percent>90(Registration⋈Students))\Pi_{\text{sname}}(\sigma_{\text{courseno}=107 \wedge \text{percent}>90}(\text{Registration} \bowtie \text{Students}))
(III) {T∣∃S∈Students,∃R∈Registration(S.rollno=R.rollno∧R.courseno=107∧R.percent>90∧T.sname=S.sname)}\{T \mid \exists S \in \text{Students}, \exists R \in \text{Registration} (S.\text{rollno}=R.\text{rollno} \wedge R.\text{courseno}=107 \wedge R.\text{percent}>90 \wedge T.\text{sname}=S.\text{sname})\}
(IV) {⟨SN⟩∣∃SR∃RP(⟨SR,SN⟩∈Students∧⟨SR,107,RP⟩∈Registration∧RP>90)}\{\langle S_N \rangle \mid \exists S_R \exists R_P (\langle S_R, S_N \rangle \in \text{Students} \wedge \langle S_R, 107, R_P \rangle \in \text{Registration} \wedge R_P > 90)\}
Show answer without attempting

Answer: A

Q2

GATE CS 2012 CSRelational DesignMCQ1 mark−1/3 if wrong
Which of the following is TRUE?
Show answer without attempting

Answer: C

Q14

GATE CS 2012 CSData ModelsMCQ1 mark−1/3 if wrong
Given the basic ER and relational models, which of the following is INCORRECT?
Show answer without attempting

Answer: C

Q15

GATE CS 2012 CSRelational QueriesMCQ1 mark−1/3 if wrong
Which of the following statements are TRUE about an SQL query?

P : An SQL query can contain a HAVING clause even if it does not have a GROUP BY clause
Q : An SQL query can contain a HAVING clause only if it has a GROUP BY clause
R : All attributes used in the GROUP BY clause must appear in the SELECT clause
S : Not all attributes used in the GROUP BY clause need to appear in the SELECT clause
Show answer without attempting

Answer: C

Q27

GATE CS 2012 CSTransactionsMCQ2 marks−2/3 if wrong
Consider the following transactions with data items P and Q initialized to zero:
T1 : read (P);
     read (Q);
     if P = 0 then Q := Q + 1 ;
     write (Q).

T2 : read (Q);
     read (P);
     if Q = 0 then P := P + 1 ;
     write (P).
Any non-serial interleaving of T1T_1 and T2T_2 for concurrent execution leads to
Show answer without attempting

Answer: B

Q43

GATE CS 2012 CSRelational DesignMCQ2 marks−2/3 if wrong
Suppose R1(A‾,B)R_1(\underline{A}, B) and R2(C‾,D)R_2(\underline{C}, D) are two relation schemas. Let r1r_1 and r2r_2 be the corresponding relation instances. B is a foreign key that refers to C in R2R_2. If data in r1r_1 and r2r_2 satisfy referential integrity constraints, which of the following is ALWAYS TRUE?
Show answer without attempting

Answer: A

Q50

GATE CS 2012 CSRelational QueriesMCQ2 marks−2/3 if wrong
How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A∪BA \cup B is the same as that of AA.

(A∪B)⋈A.Id>40∨C.Id<15C(A \cup B) \bowtie_{A.Id > 40 \lor C.Id < 15} C
Show answer without attempting

Answer: A

Q51

GATE CS 2012 CSRelational QueriesMCQ2 marks−2/3 if wrong
How many tuples does the result of the following SQL query contain?
SELECT A.Id
FROM A
WHERE A.Age > ALL (SELECT B.Age
                   FROM B
                   WHERE B.Name = 'Arun')
Show answer without attempting

Answer: B

0/200 correct0 marks

Related topics in GATE CS