edited by
4,372 views

5 Answers

0 votes
0 votes

In DBMS, generally, two types of locks are used: Shared locks and Exclusive locks.

Shared locks let multiple users just read the data. No transaction can write on an item while the item is protected by the shared lock.

Exclusive locks lock the data such that no other user can do anything — read or write; but the user that obtained the exclusive lock can write.

 

Options B,C and D are clearly wrong.

Option A makes sense for Exclusive locks, so that's our answer.



 

PS: Found something beautiful on this stackoverflow question.

 

While a teacher is writing something (exclusive lock) on the board:
 

  1. Nobody can read it, because it's still being written, and she's blocking your view => If an object is exclusively locked, shared locks cannot be obtained.
     

  2. Other teachers won't come up and start writing either, or the board becomes unreadable, and confuses students => If an object is exclusively locked, other exclusive locks cannot be obtained.
     

When the students are reading (shared locks) what is on the board:

  1. They all can read what is on it, together => Multiple shared locks can co-exist.
     

  2. The teacher waits for them to finish reading before she clears the board to write more => If one or more shared locks already exist, exclusive locks cannot be obtained.

Answer:

Related questions

5 votes
5 votes
2 answers
5
go_editor asked Jun 15, 2016
5,664 views
Which of the following contains complete record of all activity that affected the contents of a database during a certain period of time?Transaction logQuery languageRepo...
5 votes
5 votes
2 answers
6
Anuanu asked May 30, 2016
3,909 views
Purpose of 'Foreign Key' in a table is to ensureNull IntegrityReferential IntegrityDomain IntegrityNull and Domain Integrity
4 votes
4 votes
4 answers
7
ajit asked Oct 5, 2015
4,573 views
The 'command' used to change contents of one database using the contents of another database by linking them on a common key field?ReplaceJoinChangeUpdate