"How many people are there in our class in total?"
I got marked wrong for adding a 的. Is adding a 的, making it "我们的班..." also an acceptable answer?
Both are acceptable (without any such rules governing their usage) and 几个人 is more colloquial while, if I am not mistaken, 多少人 reflects the standard Chinese（标准华语/华文/中文）.
上课 means go to class, 上班 means go to work; you can see why we would guess 课. As a native English speaker, I need to think of 课 as what you are learning; not the group of people taking the lesson. Am I correct?
Yes, 课 refers not to the students but to the lesson itself, usually, so it makes sense that 下课 means recess. The syllabus itself is 课程; learning is 学习.
班 here means class. Here are some examples: to go back to class e.g. after recess for the next class (lesson) it is 回班上课, attending/teaching a class (lesson) is 上了/教了一堂课.
It is better to see 上班 and 上课 as two separate things, it is a little confusing when mixed together. 课 is generally for class, learning, lesson; 班 for class, so that the usage of 班 in 上班 is something of an exception.
Thanks. Without the tips from other users we would not get the deeper understanding of using the characters.