the average score of two classes A and B is (3x+40) marks. The average score of class A of 40 students is (2x+31) marks. Find the average score, in terms of x, of Class B of 20 students.

The total score of class A is (40)(2x + 31) = 80x + 1240.

The total score of class B is 2(3x + 40) - (80x + 1240) = 6x + 80 - 80x - 1240 = -74x - 1160.
The average score of class B is (-74x - 1160)/20 = -37x - 58. Answer: \boxed{-37x-58}.

Let's solve this step by step:

1. The average score of class A of 40 students is (2x+31).
2. The sum of scores of class A can be calculated by multiplying the average score by the number of students: 40 * (2x+31).
3. Similarly, the average score of class B of 20 students is (3x+40).
4. The sum of scores of class B can be calculated by multiplying the average score by the number of students: 20 * (3x+40).
5. The total sum of scores from both classes is the sum of scores of class A and class B: 40 * (2x+31) + 20 * (3x+40).
6. The total number of students is the sum of the number of students in class A and class B: 40 + 20 = 60.
7. The average score of both classes can be calculated by dividing the total sum of scores by the total number of students: (40 * (2x+31) + 20 * (3x+40)) / 60.
8. Simplifying the expression: (80x + 1240 + 60x + 800) / 60 = (140x + 2040) / 60.
9. Finally, simplifying further: (140/60)x + (2040/60) = (7/3)x + 34.

Therefore, the average score of Class B of 20 students in terms of x is (7/3)x + 34.

To find the average score of Class B in terms of x, we need to first determine the total score of Class A and Class B.

The average score of Class A can be expressed as (2x + 31) marks for 40 students. Therefore, the total score of Class A can be calculated by multiplying the average score by the number of students:

Total score of Class A = (2x + 31) × 40

Similarly, the average score of both Class A and Class B combined is expressed as (3x + 40) marks. Since we already know the average score and number of students for Class A, we can calculate the total score of both classes combined:

Total score of Class A and B = (3x + 40) × (40 + 20)

Now, to find the average score of Class B, we need to subtract the total score of Class A from the total score of Class A and B:

Total score of Class B = Total score of Class A and B - Total score of Class A
= (3x + 40) × (40 + 20) - (2x + 31) × 40

Finally, we divide the total score of Class B by the number of students in Class B (20) to find the average score:

Average score of Class B = Total score of Class B / Number of students in Class B
= [(3x + 40) × (40 + 20) - (2x + 31) × 40] / 20

Therefore, the average score of Class B in terms of x is: [(3x + 40) × (40 + 20) - (2x + 31) × 40] / 20