Nonparametric Monte Carlo Tests and Their Applications