Samsung Galaxy S2 is shipped with an unlocked bootloader, so it won't be locked when you Factory Reset it. But if it's rooted it will be "unrooted" and if it's a factory unlocked carrier specific version of the phone like i777 (AT&T), then it will be carrier/network locked again.