Need help on corporation formation tax consequences!!!!

Hi guys my test is this Friday and right now I am extremely confused about corporation/shareholder tax consequences regarding formation.So I tried to come up with 4 different scenarios to kind of summarize different treatment under each scenario. Please take a look and let me know if my understanding is right!!! (Assuming shareholding is exchanging for 100% of the shares) Scenario 1: FMV of asset: 50 Basis: 30 Mortgage assumed: 40 SH realized gain: 50-30 =20 SH recognized gain: 40-30=10 SH basis in stock = 30-40+10 = 0 Corporation basis in the asset: 40 Scenario 2: FMV of asset: 50 Basis: 30 cash received by SH: 5 SH realized gain: 50-30 =20 SH recognized gain: 5 SH basis in stock = 30 (correct me if I am wrong my understanding is cash received is not added to SH basis in stock) Corporation basis in the asset: 35 Scenario 3: FMV of asset: 50 Basis: 30 Mortgage assumed: 40 cash received by SH: 5 SH realized gain: 50-30 =20 SH recognized gain: 10+5=15 SH basis in stock = 30-40+10 = 0 Corporation basis in the asset: 30+15 gain recognized by SH = 45 (I am not sure) Scenario 4: FMV of asset: 50 Basis: 30 Mortgage assumed: 40 cash paid by SH: 5 SH realized gain: 50-30 =20 SH recognized gain: 40-5-30 =5 SH basis in stock = 0 Corporation basis in the asset: 35 And in any kind of situation the corporation do not recognize any gain right? please advise!!!!! thank you so much!