Will the iphone be locked after restore?

I backed up my phone awhile back. Recently I restored it to factory settings, if I restore it later with the previous back up, will the lock code I had on when I backed up my phone be re-initiated?

Most likely.

If you do a full restore, it won't because it erases all data

No the password never comes back so you don't need to worry about anything