Question

In: Computer Science

Q1. Formulate the logical constraints for the following statements (where A, B, C, and D are...

Q1. Formulate the logical constraints for the following statements (where A, B, C, and D are all binary variables):

a. If A happens then B or C happens.

b. If A and B happen then C and D must happen.

c. If A happens or B does not happen then C or D must happen.

d. If A happens or B happens then C and D happen.

This has previously been posted before on Chegg but there are conflicting answers and comments to the questions/responses.

Solutions

Expert Solution

NOTE: All the assumed events of A, B, C, D can only have two values: true or false and hence they are binary variables.

Ans a.

A = event where value of variable 'temp' is even

B = event when 'temp' is divisible by 6.

C = event when 'temp' is divisible by 3.

if ( temp % 2 == 0 )

{

int a = temp/6; // B has occurred here then only the logic reaches this point!

}

else if ( temp % 3 == 0 )

{

int a = temp/6; // C has occurred here then only the logic reaches this point!

}

Ans b.

A = 'temp' is divisible by 2

B = 'temp' is divisible by 3

C = 'temp' is divisible by 6

D = 'temp' is divisible by multiples of 6

if (( temp % 2 == 0 ) && ( temp % 3 == 0 ))

{

int a = temp/6; // a is integer and whole number since C has occured.

int b = temp/12; // Here, 12 is a multiple of 6. Also, b is integer and while number since D has occured.

}

Ans c.

A = 'temp' is divisible by 2

B = 'temp' is divisible by 3

C = 'temp' is divisible by 7

D = 'temp' is divisible by multiples of 6

if (( temp % 2 == 0 ) || ( temp % 3 == 0 )) //only the conditional operator is changed.

{

int a = temp/7; // a is integer and whole number since C has occurred but this is false!

int b = temp/12; // Here, 12 is a multiple of 6. Also, b is integer and while number since D has occured.

}

Ans d.

A = 'temp' is divisible by 2

B = 'temp' is divisible by 3

C = 'temp' is divisible by 6

D = 'temp' is divisible by multiples of 6

if (( temp % 2 == 0 ) || ( temp % 3 == 0 )) //only the conditional operator is changed.

{

int a = temp/6; // a is integer and whole number since C has occurred.

int b = temp/12; // Here, 12 is a multiple of 6. Also, b is integer and while number since D has occured.

}

Please comment for doubts!


Related Solutions

Consider a project consisting of four activities A, B, C, and D. The following are constraints...
Consider a project consisting of four activities A, B, C, and D. The following are constraints within which the project has to be conducted • A and B, the first activities of the project, can be started simultaneously. • C can be started only after A is completed. • D can be started only after B is completed Suppose the activity times for the activities are A = 4 weeks, B = 3 weeks, C = 2 weeks, D =...
What are the values of a, b, c, d, and e after the following statements? int...
What are the values of a, b, c, d, and e after the following statements? int a = 5, b = 2, c = 8, d = 7, e = 4; int x = c - b + a; a = a + x - d; b = c * d - x; c = e + a / 2; d = x - c * a; e = x + d - c;
Q1: Translate the following Bytes to Decimal and Hexadecimal a) 00001001 b) 111111111 c) 11101110 d)...
Q1: Translate the following Bytes to Decimal and Hexadecimal a) 00001001 b) 111111111 c) 11101110 d) 01010101
Consider the following reaction at 283 K: 2A + B → C + D where rate...
Consider the following reaction at 283 K: 2A + B → C + D where rate = k[A][B]2. An experiment was performed where [A]o = 2.67 M and [B]o = 0.00241 M. A plot of 1/[B] vs. time has a slope of 10.01. What will the rate of this reaction be when [A] = [B] = 0.345 M?
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what...
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what proportion of the progeny will phenotypically resemble the first parent? b) what proportion of the progeny will genotypically resemble neither parent?
Answer Q1-Q4 choose a, b, c,d and e for each questions to Answer Q1.If you find...
Answer Q1-Q4 choose a, b, c,d and e for each questions to Answer Q1.If you find a group of organisms that all appear to have similar appearances, you could say that they belong to the same species within kingdom Animalia if ____. a. they are eukaryotic, regardless of whether they are multicellular or single-celled b. they are multicellular eukaryotes that look different from other organisms in the area. c. they are multicellular eukaryotes that look the same. d. they are...
Consider these compounds: A. MgCO3 B. PbF2 C. PbS D. Ag2SO4 Complete the following statements by...
Consider these compounds: A. MgCO3 B. PbF2 C. PbS D. Ag2SO4 Complete the following statements by entering the letter corresponding to the correct compound. Without doing any calculations it is possible to determine that silver hydroxide is more soluble than , and silver hydroxide is less soluble than . It is not possible to determine whether silver hydroxide is more or less soluble than by simply comparing Ksp values. A buffer solution is made that is 0.447 M in H2S...
A) Consider these compounds: A. CoS B. Ag2CrO4 C. AgCN D. PbI2 Complete the following statements...
A) Consider these compounds: A. CoS B. Ag2CrO4 C. AgCN D. PbI2 Complete the following statements by entering the letter(s) corresponding to the correct compound(s). (If more than one compound fits the description, include all the relevant compounds by writing your answer as a string of characters without punctuation, e.g, ABC.) Without doing any calculations it is possible to determine that calcium fluoride is more soluble than ____, and calcium fluorideis less soluble than ____. It is not possible to...
Q1. a. Given a schema R (A, B, C, D, E, F) and a set F...
Q1. a. Given a schema R (A, B, C, D, E, F) and a set F of functional dependencies {A → B, A → D, CD → E, CD → F, C → F, C → E, BD → E}, find the closure of the set of functional dependencies ?+ b. Given a schema R = CSJDPQV and a set FDs of functional dependencies FDs = {C → CSJDPQV, SD → P, JP → C, J → S} 1. Find...
For each of the following simplicial complexes ,X = {[a], [b], [c], [d], [a, b], [c,...
For each of the following simplicial complexes ,X = {[a], [b], [c], [d], [a, b], [c, d]}, and X = {[a], [b], [c], [d], [e], [a, b], [b, c], [c, d], [a, d], [a, c], [a, e], [b, e], [a, b, c]},give a basis for each non-zero Hj(X).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT