Samsung Galaxy S2 is shipped with an unlocked bootloader, so it won't be locked when you Factory Reset it. If it's rooted, it will not be unrooted, but SuperSU or Superuser app itself may be removed (If it's not installed in system partition), so you'll just have to reinstall it. And if it's a factory unlocked carrier specific version of the phone like i777 (AT&T), then it may get carrier/network locked again (Booting up the first time after a factory rest it may ask you to enter the Network Unlock Code if you use a non-AT&T SIM), although in most cases this won't happen.