I am working with a CFL that requires a ballast to fire the lamp. This lamp is a G24Q-2. The lamp has four pins on the base. I am assuming that two of the pins are for the ballast connection and the other two are for constant line voltage. Is there a way to tell which pins are for which connection?
No sirree. Nothing like that.
You may be familiar with ancient inductive ballasts where preheater 1, a starter, preheater 2 and an inductive ballast were all in series with line. (and of course once the lamp strikes, it shorts out the starter and preheats, so now it's just the ballast and lamp in series, and the inductor limits current). Those things predate this modern type of bulb.
Today, you will have electronic ballasts which intake 120V and output 4 wires to go to the bulb. They do their magic electronic woo-woo inside the box, and synthesize high frequency (flicker-free) AC, doing a sequenced preheat start if needed for assured start in the cold. These make sense because the silicon needed for the magic is cheaper than the mass of copper needed for a magnetic ballast.
Especially awesome are programmed start ballasts, which preheat the bulb exactly as much as it needs for a reliable strike at any temp, and very easy on the bulb. That's the one to use for hard-to-change bulbs, or bulbs on motion sensors.
It's possible some very cheap lamp builder has found a way to wire those old-school, but I would not retain that design. I would retrofit one of the electronic ballasts. In which case you wire it according to the wiring diagram on its labeling or instructions.