学科, 科目, and 専攻: department, subjects, and major
Distinguish a chosen department, subjects taken in a semester, and a major field. Read classes outside a major without treating them as a change of major or combining separate students.
学科: a department and shared affiliation
学科 (がっか) means an academic department or course of study. 「大学では興味のある学科を慎重に選んだ。」 — “At university, I carefully chose the department that interested me.” The chosen unit is the department of interest, rather than a count of individual subjects or a reported change of major.
「同じ学科の学生と研究会を開いた。」 — “I held a study group with students from the same department.” The action is holding a study group with students from the same department. Shared department membership does not establish a shared major or year level.
科目: subjects taken or preferred
科目 (かもく) means a subject or course. 「今学期は六つの科目を履修する。」 — “I am taking six subjects this semester.” Six counts the subjects taken this semester, rather than six departments or major fields.
「一番好きな科目は歴史です。」 — “History is my favorite subject.” History is the preferred subject in this example. That preference does not identify the speaker as the modern-history major from a separate example.
専攻: a major and classes beyond it
専攻 (せんこう) means a major or field of study. 「大学では近代史を専攻している。」 — “I am majoring in modern history at college.” 専攻している describes an ongoing major in modern history, focusing on the field rather than the full list of subjects taken.
「自分の専攻と異なる分野の授業も受けた。」 — “I also took classes outside my major.” も adds classes outside the speaker's major. It broadens the stated class content without reporting a change or abandonment of the major. Keep this speaker separate from the other example unless the text identifies them as the same person.
How do 近代史を専攻している and 自分の専攻と異なる分野の授業も受けた each describe a major and the scope of classes?
Show the answer and why
The first reports an ongoing major in modern history. The second reports also taking classes outside one's own major. A major is not the full set of classes taken, and the second example neither reports a change of major nor identifies its speaker as the person in the first.

