# All database question solution

2017

a) Relationship R is one-to-many and the participation of A in R is total.

b) Relationship R is one-to-many and the participation of A in R is partial.

c) Relationship R is many-to-one and the participation of A in R is total.

d) Relationship R is many-to-one and the participation of A in R is partial.

There are 2 entities sets A , B

1 relationship set R , As relation R merges with that of A.

As many-to-one relationship set can merge towards entity set 'A'

T1: r1(X)w1(X) r1(Y)w1(Y)

T2: r2(Y)w2(Y)r2(Z)w2(Z)

Where r1(V) denotes a read operation by transaction Ti on a variable V and w1(V) denotes a write operation by transaction Ti on a variable V. The total number of conflict serializable

schedules that can be formed by T1 and T2 s --------------.

T2 : r2(Y)w2(Y)r2(Z)w2(Z)

(i) Number of conflict seralizable on T2--->T1:1

r1(X)w1(X)r1(Y)w1(Y)r2(Y)w2(Y)r2(Z)w2(Z)

(ii) Number of conflict seralizable on T2--->T1:53

S : r2(Y)w2(Y)r1(Y)w1(Y)

r1(X)w1(Y)must be before r1(Y) so that (r2(Y)w2(Y))(r1(X)w1(Y)) can place.

4C2=4!/2!*2! = 6 ways

1. r2(Y) w2(Y) r1(X) w1(X) r1(Y) w1(Y)

r2(Z) w2(Z) can place in 6C2=6!/4!*2!= 15 ways

Like wise

2. r2(Y)r1(X)w1(X)w2(Y)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 4C2=6 ways

3. r2(Y)r1(X)w2(Y)w1(X)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 5C2=10 ways

4. r1(X)w1(X)r2(Y)w2(Y)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 4C2=6 ways

5. r1(X)r1(Y)w1(Y)w2(X)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 5C2=10 ways

6. r1(X)r2(Y)w1(X)w2(Y)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 4C2=6 ways

So total no of conflict serializable of T1 and T2 = 53+1=54 ways

2016

a) VXYZ

b) VWXZ

c) VWXY

d) VWXYZ

Super key

= Candidate key + Other Attribute of set

= Primary key + Other Attribute of set

Given , Primary key = VY

So, VXYZ , VWXY , VWXYZ are super keys except VWXZ.

(VOLUME,NUMBER,STARTPAGE,ENDPAGE,TITLE,YEAR,PRICE)

The primary key is (VOLUME,NUMBER,STARTPAGE,ENDPAGE) and the following functional dependencies exist in the schema.

(VOLUME,NUMBER STARTPAGE,ENDPAGE)--->TITLE

(VOLUME,NUMBER) --->YEAR

(VOLUME,NUMBER,STARTPAGE,ENDPAGE)--->PRICE

The database is redesigned to use the following schemas.

(VOLUME,NUMBER,STARTPAGE,ENDPAGE,TITLE,PRICE)

(VOLUME,NUMBER,YEAR)

Which is the weakest normal form that the new database satisfies,but the old one does not?

a) 1NF

b) 2NF

c) 3NF

d) BCNF

It is 2NF because initially it contains partial dependency.

a) Topological order

b) Depth-first order

c) Breadth-first order

d) Ascending order of transaction indices

If a schedule(s) is serializable , the topological order of a graph(also called precedence graph)yield a serial schedule.

a) Anarkali's public key

b) Salim's public key

c) Salim private key

d) Anarkali's private key

Sign is sender's private key and the receiver side verification of the signature is done with sender public key.

P : R is reflexive

Q : R is transitive

Which one of the following statement is TRUE?

a) Both P and Q are true

b) P is true and Q is flase

c) P is false and Q is true

d) Both P and Q are false

Reflexive:(a,a)R(a,a)

Since a=<a, and a=<a

Transitive: (a,b)R(c,d)and(c,d)R(m,n)then(a,b)R(m,n)

Suppose(a,b)R(c,d)

===> a=<c and b=<d

and (c,d)R(m,n)

===> c=<m, d=<n

Since a=<c, and c=<m so a=<m

b=<d and d=<n , so b=<n

- (a,b) R (m,n)

S=r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X); a1; a2

Where ri(Z) denotes a read operation by transaction Ti on a variable Z, wi(Z) denotes a write operation by Ti on variable Z and ai denotes an abort by transaction Ti.

Which one of the following statements about the above schedule is TRUE?

a) S is non-recoverable

b) S is recoverable, but has a cascading abort

c) S does not have a cascading abort

d) S is strict

**Question 1).**An ER model of a database consists of entity types A and B. These are connected by a relationship R which does not have its own attribute. Under which one of the following conditions, can the relational table for R be merged with that of A?a) Relationship R is one-to-many and the participation of A in R is total.

b) Relationship R is one-to-many and the participation of A in R is partial.

c) Relationship R is many-to-one and the participation of A in R is total.

d) Relationship R is many-to-one and the participation of A in R is partial.

**Correct answer:-**d**Explanations:-**There are 2 entities sets A , B

1 relationship set R , As relation R merges with that of A.

As many-to-one relationship set can merge towards entity set 'A'

**Question 2).**Two transactions T1 and T2 are given asT1: r1(X)w1(X) r1(Y)w1(Y)

T2: r2(Y)w2(Y)r2(Z)w2(Z)

Where r1(V) denotes a read operation by transaction Ti on a variable V and w1(V) denotes a write operation by transaction Ti on a variable V. The total number of conflict serializable

schedules that can be formed by T1 and T2 s --------------.

**Answer:-**54**Explanations:-**T1 : r1(X)w1(X)r1(Y)w1(Y)T2 : r2(Y)w2(Y)r2(Z)w2(Z)

(i) Number of conflict seralizable on T2--->T1:1

r1(X)w1(X)r1(Y)w1(Y)r2(Y)w2(Y)r2(Z)w2(Z)

(ii) Number of conflict seralizable on T2--->T1:53

S : r2(Y)w2(Y)r1(Y)w1(Y)

r1(X)w1(Y)must be before r1(Y) so that (r2(Y)w2(Y))(r1(X)w1(Y)) can place.

4C2=4!/2!*2! = 6 ways

1. r2(Y) w2(Y) r1(X) w1(X) r1(Y) w1(Y)

r2(Z) w2(Z) can place in 6C2=6!/4!*2!= 15 ways

Like wise

2. r2(Y)r1(X)w1(X)w2(Y)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 4C2=6 ways

3. r2(Y)r1(X)w2(Y)w1(X)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 5C2=10 ways

4. r1(X)w1(X)r2(Y)w2(Y)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 4C2=6 ways

5. r1(X)r1(Y)w1(Y)w2(X)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 5C2=10 ways

6. r1(X)r2(Y)w1(X)w2(Y)r1(Y)w1(Y)

r2(Z)w2(Z) can place in 4C2=6 ways

So total no of conflict serializable of T1 and T2 = 53+1=54 ways

2016

**Question 1.)**Which of the following is not a superkey in a relational schema with attributes V, W, X, Y, Z, and primary key V Y?a) VXYZ

b) VWXZ

c) VWXY

d) VWXYZ

**Correct Answer:-**b**Explanation**Super key

= Candidate key + Other Attribute of set

= Primary key + Other Attribute of set

Given , Primary key = VY

So, VXYZ , VWXY , VWXYZ are super keys except VWXZ.

**Question 2.)**A database of research articles in a journal uses the following schema.(VOLUME,NUMBER,STARTPAGE,ENDPAGE,TITLE,YEAR,PRICE)

The primary key is (VOLUME,NUMBER,STARTPAGE,ENDPAGE) and the following functional dependencies exist in the schema.

(VOLUME,NUMBER STARTPAGE,ENDPAGE)--->TITLE

(VOLUME,NUMBER) --->YEAR

(VOLUME,NUMBER,STARTPAGE,ENDPAGE)--->PRICE

The database is redesigned to use the following schemas.

(VOLUME,NUMBER,STARTPAGE,ENDPAGE,TITLE,PRICE)

(VOLUME,NUMBER,YEAR)

Which is the weakest normal form that the new database satisfies,but the old one does not?

a) 1NF

b) 2NF

c) 3NF

d) BCNF

**Correct Answer:-**b**Explanation:**It is 2NF because initially it contains partial dependency.

**Question 3.)**Suppose a database schedule S involves transactions T1,......Tn.construction the precedence graph of S with vertices representing the conflicts .If S is serializable, which one of following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule?a) Topological order

b) Depth-first order

c) Breadth-first order

d) Ascending order of transaction indices

**Correct Answer:-**a**Explanation:**If a schedule(s) is serializable , the topological order of a graph(also called precedence graph)yield a serial schedule.

**Question 4.)**Anarkali digitally signs a message and sends it to salim.verification of the signature by salim requiresa) Anarkali's public key

b) Salim's public key

c) Salim private key

d) Anarkali's private key

**Correct Answer:-**a**Explanation:-**Sign is sender's private key and the receiver side verification of the signature is done with sender public key.

**Question 5.)**A binary relation R on N, N is defined as follows;(a,b)R(c,d)if a=<c or b>=d.consider the following propositions.P : R is reflexive

Q : R is transitive

Which one of the following statement is TRUE?

a) Both P and Q are true

b) P is true and Q is flase

c) P is false and Q is true

d) Both P and Q are false

**Correct Answer:-**a**Explanation:-**A binary relation R on N*N is defined as (a,b)R(c,d)Reflexive:(a,a)R(a,a)

Since a=<a, and a=<a

Transitive: (a,b)R(c,d)and(c,d)R(m,n)then(a,b)R(m,n)

Suppose(a,b)R(c,d)

===> a=<c and b=<d

and (c,d)R(m,n)

===> c=<m, d=<n

Since a=<c, and c=<m so a=<m

b=<d and d=<n , so b=<n

- (a,b) R (m,n)

**Question 6.)**Consider the following database schedule with two transactions, T1 and T2.S=r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X); a1; a2

Where ri(Z) denotes a read operation by transaction Ti on a variable Z, wi(Z) denotes a write operation by Ti on variable Z and ai denotes an abort by transaction Ti.

Which one of the following statements about the above schedule is TRUE?

a) S is non-recoverable

b) S is recoverable, but has a cascading abort

c) S does not have a cascading abort

d) S is strict

**Correct Answer:-**C**Explanation:-**As there is no dirty-read in the given schedule, the schedule is both recoverable and cascadeless.
## No comments