PocketPills interview question

What is pessimistic and optimistic lock