Does having officers available but not assigned penalize XP gain?
Yes, it only matters if you have officers and the number of skills they have, period, it doesn't matter which ship they're assigned to or if they're assigned at all. Just the fact that you have them is what matters. Mercenaries also count as officers.
At the expense of a threadjack, here's what I can tell so far about the XP bonus. It's just a simple comparison of your fleet's DP with the enemy fleet's DP, far as I can tell, i.e. if the enemy fleet's DP is 3x your fleet's DP, then you get a +200% XP bonus. But with the following stipulations:
* Officers count as 7.5 DP, plus 3.75 DP for every skill they have (elite or not). So a level 4 officer (gamma) is worth 22.5 DP, a level 6 officer (beta) is worth 30 DP, a level 8 officer (alpha) is worth 37.5 DP. Yes cores use the same formula.
* This only counts the actual number of skills. So an officer that has enough XP to be level 6, but is still a level 1 officer with just 1 skill, still counts as a level 1 officer.
* It doesn't matter which ship the officer is assigned to, nor if the officer is assigned at all, nor if it's a mercenary or regular officer. If it's on your roster, it counts, period.
* You the player character also count as an officer. So far as I can tell, so yes at level 15 you the player contribute 63.75 DP to your fleet's DP amount for the XP formula, regardless of whether or not you use those skills (so might as well as use them). Although thus far in my testing it doesn't always match up, so there may be something more to it, but it seems pretty close.
* A ship with the "CIVILIAN" tag in ship_data.csv always counts as 1/4 of their DP, regardless of their weapons or hullmods (i.e. militarized hull hullmod). Note I said the "CIVILIAN" tag, and not the "civilian-grade hull" hullmod, so ships like the Shepherd or Venture or Atlas 2 do *not* fall into this category.
* Other ships count as 1/4 of their DP if they have no weapons (including no fighters). Hullmods don't matter. But if they have any weapons (including built-in), they'll count for the full DP. This means that Shepherds (which have a built-in fighter) will count as full DP, unless you put converted fighter bay on it, and no weapons, at which point it'll count for 1/4 of its DP.
So if you're looking to maximize the XP bonus, you want to minimize taking on officers, and have high-level officers rather than more lower-level ones (a level 4 officer costs as much as 2 level 1 officers, but you get twice the number of skills). Also you might as well as make the skills elite, since that improves the ship but with no effect on the XP bonus. You might try to make use of civilian ships (again, those with the tag, not the hullmod), since they count as 1/4 the DP, but I haven't bothered with that.
It also means that you should look for enemy fleets with lots of officers. The DP contribution from enemy officers can easily outweigh that of their ships, especially for late-game fleets like the ones of [REDACTED]. So that's where the real bonus comes from.
I'm sure someone can point to where this is calculated in the code, for the full specifics, but this is from testing in-game in 0.95.1a-RC6.
Do you get double exp? Cause that would make it worth not getting officers until the entire fleet has built ins
It depends on your fleet. For example a full combat fleet would be 240 DP, then you have some support ships which may cost say 15 DP, then your own character which costs 63.75 DP. If you have 10 level 6 officers then that's 300 DP, so cutting them out would almost double your XP. And obviously any alpha cores being used on ships (not just sitting in inventory) would cost you 37.5 DP each.
Built-in hullmods do not affect your XP bonus, so you might as well as use them.
-----
I had a dream of using Support Doctrine for a fleet of a couple of big ships (say, Ziggurat and Radiant) supported by say...25 Monitors. Since no officers would be used, the XP bonus would be up at the max of +500% most of the time. Unfortunately I'm running into a problem where the total fleet points ("fleet pts" in ship_data.csv) are so small that nearby [REDACTED] fleets refuse to assist, making it difficult to do multi-fleet testing for the full +500% XP bonus. Sigh. I know this is purely a fleet point issue since if I change the fleet points of the Monitor from 5 to say 15 and make no other changes, or if I change the fleet points of the Ziggurat from 40 to say 400 and make no other changes, then the other fleet will join just fine. (Doing so does not affect the XP bonus, since this is fleet points, not deployment points i.e. DP.) Not sure how the "nearby fleet assist or not" code works, so I don't know if frigate fleet points is reduced or something making this fleet considered too "small", even though my regular fleet of say Odysseys/Apogees for example can attract multiple fleets just fine.