find the number of injections/surjections

  1. The number of bijections is given by $n!$, in which $n$ denotes the common cardinality of your sets. To see this, note that any bijection can be written as a permutation followed by a given bijection.
  2. An injection is a bijection onto its image. Thus you can find the number of bijections by counting the possible images and multiplying by the number of bijections to said image. In your notation, this number is $$\binom{q}{p} \cdot p!$$
  3. As others have mentioned, surjections are far harder to calculate. They satisfy certain recursions, e.g. given here. The number of surjections is also related to the Stirling numbers (of the second kind.