Let K, the field generated by the coefficients of f, have t=2^n elements.
If p=q=0, f has a triple root. If q is not 0, then f is separable. Assume q not 0.
If p=0 and n odd, then f has exactly one root in K. If p=0 and n even then f has 0 or 3 roots in K.
Assume now that f has at least 1 root in K. Let tr be the trace of K over the prime field. Put B=1+(p^3/q^2). Then f has 3 roots iff tr(B)=0.

The question if f has no roots (i.e. f irreducible) can be done by Berlekamp's
algorithm.