Step 1: Apply the bracketing technique: mentally place commas around, and then delete, any phrase beginning with "along with", "as well as", or "together with", because these phrases never affect the number of the main verb.
Step 2: Bracketing out "along with her students" leaves the simplified sentence "The teacher were going to visit the science museum next Monday morning." Reading this stripped-down version instantly reveals the mismatch, since "the teacher" is singular and "were" is plural.
Step 3: The true grammatical subject was never the combined group, it is only "the teacher", so the verb must be the singular "was", giving "was going to visit".
Step 4: Segment (A), "The teacher along with her students", is grammatically fine as a noun phrase; the fault is only in the verb that follows it, which sits in segment (B), "were going to visit". Segments (C) and (D) contain no errors.
Correct option: (4) Part B.