FabHotels interview question

What are optimistic and pessimistic locking?