Query Language _ DPP 01
Query Language _ DPP 01
[MCQ] [MSQ]
1. Consider the following statements: 4. Consider the following relations:
Enroll (Sid, Papercode), Paper(Papercode, Desc)
S1: List N (List N–1……(List 1(R)) Which of the following relational algebra displays the
List 1 (List 2……(List N (R)) sid’s who only enrolled for Papercode having
descriptions (Desc) as “CS”?
( ) ( (
S2: cn cn–1 ..... ( c1 ( R ) ) c1 c2 .... CN ( C ) )) (a) sid (Enroll ⋈ Paper)
Desc = CS
Which of the following statement(s) is/are correct?
(a) S1 only (b) sid (Enroll) – sid ((Enroll ⋈ (Paper))
Desc = CS
(b) S2 only
(c) Both S1 and S2 only (c) sid (Enroll) – sid( (Enroll ⋈ (Paper))
Desc < > CS
(d) Neither S1 nor S2
(d) None
[NAT]
[MCQ]
2. Consider the following relations- 5. Consider a relations work (EmpiD, Project ID)
Enroll (CandidateID, Papercode) with 5000 tuples and The suitable relational algebra expression that projects
the employee ids who work exactly in one project is-
Count(Papercode, Number_of_appearing_candidates)
(a) Empid (Work) – Empid(Work ⋈ E, P (work))
with 29 tuples. Empid = E
Assume, one candidate can enroll for multiple Project Id = P
Papercode. Let p and q be the maximum and minimum (b) Empid (Work ⋈ E, P (work))
Empid = E
number of records in Count ⋈ Enroll then the value of
Project ID P
p + q is .
x
(c) p = x, q = y (d) p = x, q =
y [MSQ]
9. Consider the relation-
[MCQ] Works (Eid Pid) project (Pid, Name)
The relational algebra expression that displays the Eids
7. Let R1 and R2 be two relations with n and m tuples. who work in every project Name = ‘M .
S1: The maximum number of records in R1– R2 is n. (a) Eid, Pid (works)/ Pid (Name = M (Project))
S2: The minimum number of records in R1 R2 is max (b)
(n, m)
(a) S1 only
( Work ) pid ( Project ) − Eid Pid ( works )
(b) S2 only Eid ( Work ) − Eid Name = m
Eid
(c) Both S1 and S2
(d) Neither S1 nor S2 (c)
[MCQ] ( Work ) pid ( Project ) –Eid Pid ( works )
Eid ( Work ) − Eid Name < > m
8. Consider the following RA expression-
P: sid (student) –sid (student ⋈ I, G, M (Student)) (d) None
Marks < M
Gender = G
On a relation student (sid, Gender, Marks) and I = sid, [MCQ]
G = Gender, M = Marks. 10. Consider the two relations R1 and R2 such that they
The above R.A displays? have no attributes in common then-
(a) The sid of the student who obtained the maximum S1: R1 ⋈ R2 = R1 × R2
marks.
S2: R1 ⋈ R2 =
(b) The sids of the male and female students who
obtained the maximum marks in their respective Which of the given statement(s) is/are correct?
gender. (a) S1 only
(c) The sids of male student who scored higher than (b) S2 only
(c) Both S1 and S2
all the female students
(d) None (d) Neither S1 nor S2
3
Answer Key
1. (b) 6. (b)
2. (10000) 7. (c)
3. (b) 8. (b)
4. (a, c) 9. (a, b)
5. (c) 10. (a)
4
5. (c)
Retrieve employee ID’s work exactly in one project
= All emp IDs – Emp IDs who work in at least two
projects etc.
5
(b) A 1
A 1
A 2
3
B
A 2
B 1
Eid P– EidPid ( Works ) = − C
3
3
B C 2
Q
C 1
C 1
C 3
P: Eid ( works ) Pid ( Project ) A 3
Name = M
A B 1
B 1 Gives Eid who dose not = = B
Eid B 3
3
C
A
A
Eid (Works) – Q = B – B = Eids who
C B
P: A 1
A 3 works in all ‘M’ projects
B 1
B 3 10. (a)
If the relations R1 and R2 have no attributes in common,
C 1
the result of natural join is equal to the cross product of
C 3 R1 and R2.
The condition of equijoin is not inaccessibility between
two same attributes. So, S1 is CORRECT.