ERNI interview question

What is optimistic and pessimistic locking?