Step 1: Split the four cases by their x-axis:
In options (1), (3) and (4) the x-axis is time: months, a time period, days.
In option (2) the x-axis is a list of classes. Classes are names, not a time line.
Step 2: Apply the rule:
When the x-axis is time and we want a trend, we use a line chart.
When the x-axis is a set of separate groups and we want to compare sizes, we use a bar chart.
Step 3: Apply it to the options:
Temperature, stock price and website traffic are trends, so each needs a line.
Student counts of classes are group totals, so each needs a bar. The bar heights can be compared at a glance.
Final Answer:
Option (2), to compare the number of students in different classes.