Can I do a t-test to test significance? I need a statistical test to determine if one group of ten classrooms with different numbers of students in each class has a class average on a test.  Group two has 12 classrooms also with different numbers of students in each class and has a class average.  
 A: If you have the raw data, you should not perform $t$-tests (either one- or two-sample) in the normal way.  That is because the data will not be independent--the students who come from the same class will be more similar to each other than to students from other classes.  Due to this non-independence, you won't have quite as much information as your $N$ implies.  Most likely, you would want to fit a multilevel / mixed-effects model with students as 'level 1' units and classes as 'level 2' units.  This amounts to including a random intercept for each class.  You can pursue this strategy whether you are doing a one-sample or two sample test.  
On the other hand, if you only have the class averages from different classes with differing numbers of students in each, and you know what the $n_j$'s are, you may want to do a weighted $t$-test.  This will be more efficient than an unweighted version.  The rationale is that the averages from the classes with more students are more precise than the averages from smaller classes, thus they should get more weight in the calculation.  
A: As I understand it, you want to compare group 1 with group 2, based on data consisting of 10 class averages in group 1 and 12 class averages in group 2. You can do this reasonably well, as long as the class sizes don't differ too much from one another. It's OK because the $t$ test is fairly robust to minor departures from its underlying assumptions (independence, normality, equal variances). If the classes are wildly different in size, though, then the normality and equal-variance assumptions go awry, because you wind up with mixtures of distributions with different variances.
A: Yes if your data do not violate distributional assumptions (most importantly, equal variance).
