Handling breaks in the top plate for a long partition wall
Option A is acceptable for exterior walls and bearing walls, assuming a second top plate is installed correctly....lapped a minimum of 24” (See ICC R602.3.2.) and nailed properly. BTW, the top plate splice need not occur at a stud. (Nailing is complicated...it depends a lot on what seismic zone you’re in.)

Option B is allowed, but splicing (nailing) of studs together is important...and yes, it’s critical to keep your 16” or 24” wall stud spacing consistent, because the wall sheathing and interior gypsum board is laid out to those dimensions. 

Oh, with regard to distance of rafters and trusses to studs, yes, they need to occur within 5” of a stud.