I am always so confused whether to do a chi square test or a t test in the sums given by my biostats teacher. Does anyone have a simple rule to decide this?
This is a very subtle question and I encourage you to read the Wikipedia articles on these different subjects (t-test, chi-squared test, p-value, etc) because the authors worked hard to combat common misconceptions about these commonly used statistical tests. Here is a rather oversimplified rule-of-thumb for these different tests:
I'd hate to have made a huge mistake, so please edit my answer and/or contribute your own if you think I am completely misrepresenting these topics!
As A.Kennard said t-test is applied when the random variable is normally distributed. How to know what is normally distributed is a relevant question. Regular measures which suffer some random error of measurement are normally distributed. The mean values estimated from different samples (the experiment that generates that sample may have any distribution) follow normal distribution. For e.g mean time interval of a radioactive decay- the interval itself is exponentially distributed but the mean of the mean decay interval will be normally distributed. You can reason that it is again an error of measurement that leads to variation in the mean value calculated in different samples. This is called the central limit theorem.
A normal distribution has two parameters- mean and variance i.e. you need to know these values beforehand to construct a normal distribution. A uniform distribution has no parameters- that doesn't mean that uniformly distributed samples have no mean or variance (in this case mean and variance are sample properties not distribution parameters). A t-test or z-test is done to see if a sample is a representative of a given normal distribution. That again means that the calculated mean and variance are equivalent to the corresponding distribution parameters. In case of z-test you know the population variance (distribution parameter). You may ask how can anyone possibly know the population variance beforehand. An example is a case in which you already know the error rate of your measuring device (may be provided by the manufacturer or interpreted from its design).
There are several variants of the $\chi^2$ test. But what is common between them is that they refer to $\chi^2$ distribution. Variances, which are always positive cannot be a normally distributed. These follow $\chi^2$ distribution. The F-test for variances uses the ratio of the $\chi^2$ statistic of the two random variables denoting variances. Even in the Pearson $\chi^2$ test, the test statistic is a sum of squares which makes it always positive. In fact this $\chi^2$ distribution is also used in t-test. As . Kennard said, one of the assumptions of t-test is that the population variance is unknown but assumed to be equal. Since population variance is unknown it has to be estimated from the sample. Like the case with all estimates you dont have a fixed value but a range of acceptable values falling in some confidence intervals. T-distribution is basically an average of several normal distributions with variance values falling in the allowed confidence interval of a $\chi^2$ distribution.
It is not necessary that categorical data are to be tested by $\chi^2$ test. Coin toss experiment gives rise to a categorical but it can be tested against a binomial distribution. So $\chi^2$ test can be used for categorical data but it is not the only test.