Option expiry and Margin required

Does selling and buying back of options is required on the expiry day if the contract expires worthless ,
Also if the sell position for any contract is there with is worthless ,will the extra margin be required by broker ?

You don’t have to do anything.

Yes, you will require additional margins on last two days of Expiry Week (Wednesday and Thursday) irrespective of moneyness of contract.

PS: Extra margin requirement is only for Stock F&O as they are compulsory physically settled. This doesn’t apply to Index F&O as these contracts are cash settled.