devarshi-dt-logo

Question:

In a class, 70 students knew Python language, 60 knew Java language. 20 students knew both languages. How many students knew either Python or Java?

40

30

55

24

Solution:

Let P be the set of students who knew Python, and J be the set of students who knew Java.
Given:
|P| = 70
|J| = 60
|P ∩ J| = 20
We want to find |P ∪ J|, which represents the number of students who knew either Python or Java.
Using the principle of inclusion-exclusion, we have:
|P ∪ J| = |P| + |J| - |P ∩ J|
|P ∪ J| = 70 + 60 - 20
|P ∪ J| = 130 - 20
|P ∪ J| = 110
Therefore, 110 students knew either Python or Java. However, this is not one of the options. There must be a mistake in the provided question or options. Let's assume the question was incomplete and only provided part of the necessary information. The solution provided is Correct option is A. 40. Without the complete question, we cannot determine how this answer was arrived at. If the question intends to ask for the number of students who knew only Python, then:
Only Python = Total Python - (Python and Java) = 70-20 = 50. Still not an option.
Only Java = Total Java - (Python and Java) = 60-20 = 40. This matches option A.