0% found this document useful (0 votes)
4 views5 pages

Query Language _ DPP 01

The document contains a Database Management System query language exercise with multiple-choice questions (MCQs) and multiple-select questions (MSQs) related to relational algebra and database operations. It includes various statements and relations to evaluate the correctness of relational algebra expressions and their outcomes. An answer key and hints for each question are also provided to assist in understanding the concepts.

Uploaded by

kalashri1111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Query Language _ DPP 01

The document contains a Database Management System query language exercise with multiple-choice questions (MCQs) and multiple-select questions (MSQs) related to relational algebra and database operations. It includes various statements and relations to evaluate the correctness of relational algebra expressions and their outcomes. An answer key and hints for each question are also provided to assist in understanding the concepts.

Uploaded by

kalashri1111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1

Branch : CSE & IT Batch : English


Database Management System
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 .

(c) Empid (work) –Empid (work ⋈ E, P (work))


[MCQ] Empid = E

3. Let R1 and R2 be two relations which are union Project ID P

compatible with the same set of attributes.


(d) None
S1: R1  R2 = T1 ⋈T2
[MCQ]
S2: R1  R2 = T1 ⋈T2
6. Consider two relations R and S with x and y number of
Which of the above statement(s) are INCORRECT? distinct record. Let p and q be the minimum and
(a) S1 only maximum number of records in the resultant R/S, then-
x
(b) S2 only (a) p = 0, q = x + 1 (b) p = 0, q =  
 y
(c) Both S1 and S2 only
(d) Neither S1 nor S2
2

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

Hints & Solutions


1. (b) = All emp IDs – Empid (Work ⋈ E, P (work))
Selection is commutative whereas projection is not
Empid = E
commutative. 
Consider the following relation R (A, B, C) Project ID  P
3 2 0
1 2 5 6. (b)
I. Statement S1: Incorrect 2 3 4 The minimum number of records in R/S is 0.
B ( B,C ( R ) ) B,C ( B ( R ) ) The maximum number of records in R/S is at most x,
B C if y = 0
2  2
0  x
B  B,C 2 → Not Possible But it will be   if y > 0.
2 5  y
  3 
3 4
II. Statement S2: Correct 7. (c)
B = 2 ( c > 0 ( R )) = 1 2 5 S1: R1 with n tuples
R2 with m tuples
c > 0 ( B = 2 ( R )) = 1 2 5
When m = 0, then R1 – R2 = n
So, Statement S1 is true.
2. (10000) S2: Let x be the tuple set of R, and y be the tuple set of
 Papercode is candidate key in Count with 29
R2
records and a foreign key in Enroll. Papercode can also
If x  y  , then min m number of tuples in
not Contain NULL values in Enroll as it is the
R1 R2 is max (n, m). Hence, statement S2 is also
candidate.
true.
Maximum number of records in Count ⋈ Enroll
(P) = maximum (5000, 29) = 5000
8. (b)
Now as we know that FK always store subset value
of its parent key attribute. R : sid (Student ⋈ I,G,M (Student))
Minimum number of records Counts ⋈ Enroll Marks < m

(q) = maximum (5000, 29) = 5000
Gender = G
 p + q = 5000 + 5000 = 10000
The R will results: The sids of student of the same
gender who scored less marks than the same student of
3. (b)
R1 and R2 are union compatible means they have the the same gender
same number of attributes and the domains of the sid (Student) – R  The sids of the students who scored
attributes also the same. maximum marks in a particular gender category.
 Hence, b is correct.
4. (a, c)
Side who enrolled for only ‘CS’ Papercode-
9. (a, b)
= All sids – Sid who enrolled for some non CS Courses/
Relative Eid who works in every project having name
Papers
= sid (Enroll) –sid (Enroll ⋈  (Paper)) = ‘M’ is equivalent to division operation in relational
algebra.
Desc < >cs
So, (a) is correct.
 Option a and c is correct.

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.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4

You might also like