existence of a limit in a improper integral 
Consider the limit 
  $$ \lim_{n \to \infty} \int_0^n e^{-px} \cos(ax)\, dx.$$
The exercise is asking about the values of $p$ and $a$ which the limit above exists.
a) exists for infinity values of $p$
b) exists for a finite values of $a$
c) exists for every real $p$ but not for every value of $a$
d) exists for every real $p$ and real $a$
e) none of the above

After a while I'm guessing the answer d) is correct. But I am not sure. Also, asking if the limit above exists, is the same thing as asking if the integral converges? If I evaluate the limit for a negative $p$ and a positive $a$ the integral oscillates between -infinity and infinity. That means the integral diverges and the limit above doesn't exist? I will be thankful if someone can provide a answer and a explanation.

Hint. Note that, by integration by parts, if $p^2+a^2\not=0$ then
$$\int e^{-px} \cos(ax)\, dx=\frac{e^{-px}(a\sin(ax)-p\cos(ax))}{p^2+a^2}.$$
Is it easier to go on now?
Does the limit exist for $p=-1$ and $a=\pi$?
