Here 2 is segment number and 40 is the offset.
Check if offset < limt(or length),
Go to segment number 2 in the table and see what’s the base address. It’s 40.
Now add the offset with this base address= 40+40 = 80
This is the physical address.
In 2nd case (1,500)
segment number is 1, Offset = 500.
Check if offset<limit
Hence, it is not valid. So it would end up in segmentation fault.