45.3k views
0 votes
g Programs submitted by programs in a computer science course are examined for syntax errors and logic errors. Suppose 36% of all programs have syntax errors, 47% have logic errors, and 56% have at least one of those two error types. (a) What is the probability a program contains both error types? (b) What is the probability a program contains neither error type? (c) What is the probability a program has logic errors, but not syntax errors? (d) What is the probability a program either has no syntax errors or has no logic errors?

2 Answers

1 vote

Answer:

The answer is below

Explanation:

Let S denote syntax errors and L denote logic errors.

Given that P(S) = 36% = 0.36, P(L) = 47% = 0.47, P(S ∪ L) = 56% = 0.56

a) The probability a program contains both error types = P(S ∩ L)

The probability that the programs contains only syntax error = P(S ∩ L') = P(S ∪ L) - P(L) = 56% - 47% = 9%

The probability that the programs contains only logic error = P(S' ∩ L) = P(S ∪ L) - P(S) = 56% - 36% = 20%

P(S ∩ L) = P(S ∪ L) - [P(S ∩ L') + P(S' ∩ L)] =56% - (9% + 20%) = 56% - 29% = 27%

b) Probability a program contains neither error type= P(S ∪ L)' = 1 - P(S ∪ L) = 1 - 0.56 = 0.44

c) The probability a program has logic errors, but not syntax errors = P(S' ∩ L) = P(S ∪ L) - P(S) = 56% - 36% = 20%

d) The probability a program either has no syntax errors or has no logic errors = P(S ∪ L)' = 1 - P(S ∪ L) = 1 - 0.56 = 0.44

User Selecsosi
by
4.5k points
3 votes

Answer:

Kindly check explanation

Explanation:

Given the following :

Programs with syntax errors ; n(S) = 36%

Programs with logic errors; n(L) = 47%

Programs with atleast one of the two errors = 56%

P(S) = 0.36 ; p(L) = 0.47

P(SnL) = x

P(S) only + p(L) only + p(SnL) = 0.56

P(S) only = 0.36 - x

P(L) only = 0.47 - x

P(SnL) = 0.36 - x + 0.47 - x + x = 0.56

0.83 - x = 0.56

x = 0.27

B) probability that program contains neither error :

1 - p(program contains atleast one of the two errors)

1 - 0.56 = 0.44

C) probability of logic error but no syntax error :

P(L) - p(SnL)

= 0.47 - 0.27

= 0.20

g Programs submitted by programs in a computer science course are examined for syntax-example-1
User Sujey
by
5.7k points