Question

boolean x = true; boolean y = false; boolean z = true; Given the following declarations,...

boolean x = true;
boolean y = false;
boolean z = true;

Given the following declarations, evaluate each boolean expression labelled a-f below as either true or false: (Section 3.7)

a. y && z

b. y || z

c. !y

d. (x && y) || (x && z)

e. !(x && y)

f. (!y) && (x && z)

Homework Answers

Answer #1

boolean x = true;

boolean y = false;

boolean z = true;

a. y && z

Answer: y && z -> False && true ->false

The above statement is resolved as false && true, the logical and (&&) returns true if both the operands are true, here in our case both the operands are not true hence the expression returns false.

b. y || z

Answer: y || z -> false || true -> true

The above statement is resolved as false || true, the logical or (||) returns true if any one of the operands is true, here in our case one of the operands is true hence the expression returns true.

c. !y

Answer: true

In the above statement logical not (!) is used which gives the reverse of the result after evaluating the expression. Now, we have y=false, hence !y return true.

d. (x && y) || (x && z)

Answer: (true && false) || (true && true) -> (false) || (true)-> true

For the above expression the answer is true, here we have applied OR between two expressions.

The first expression (x && y) returns false since y is false

The second expression (x && z) returns true since both x and z are true

Finally applying Or between the above two we have false|| true which returns true

e. !(x && y)

Answer: !(x && y) -> !(true && false) -> !(false) -> true

In the above expression (x && y) is false as y is false, now we have !(false) which is true

f. (!y) && (x && z)

Answer: (!y) && (x && z) -> !(false) && (true && true) -> !(false) && (true) -> true && true

-> true

In the above statement we have && applied between two expression

The first expression !y returns true as y is false

The second expression x && z returns true as both x and z are true.

Now (!y) && (x && z) is resolved as true && true which is true

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Given F (x, y, z) = (x’ + z) (x’ + y’)’ (y’ + z’) write...
Given F (x, y, z) = (x’ + z) (x’ + y’)’ (y’ + z’) write the expression for the dual of F and complement of F.
2. Given the following declarations, explain why some of the following assignments are incorrect int x...
2. Given the following declarations, explain why some of the following assignments are incorrect int x = 10; char y = 'A'; int *ptr1; char *ptr2 = &y; a. x = y; b. ptr1 = ptr2; c. ptr1 = &x; d. x = &ptr1; e. ptr2 = &x; Thanks.
Prove the following properties of Boolean algebras. Give a reason for each step. 1.(x.y)+(x′.z)+(x′.y.z′)=y+(x′.z) 2.x.y+x′=y+x′.y′ 3.x.y+y.z.x′=y.z+y.x.z′...
Prove the following properties of Boolean algebras. Give a reason for each step. 1.(x.y)+(x′.z)+(x′.y.z′)=y+(x′.z) 2.x.y+x′=y+x′.y′ 3.x.y+y.z.x′=y.z+y.x.z′ Prove that for any Boolean algebra: a. If x+y=0,then x=0 and y=0. b. x = y if and only if x . y′ + y .x′ = 0.
(a) TRUE / FALSE If X is a random variable, then (E[X])^2 ≤ E[X^2]. (b) TRUE...
(a) TRUE / FALSE If X is a random variable, then (E[X])^2 ≤ E[X^2]. (b) TRUE / FALSE If Cov(X,Y) = 0, then X and Y are independent. (c) TRUE / FALSE If P(A) = 0.5 and P(B) = 0.5, then P(AB) = 0.25. (d) TRUE / FALSE There exist events A,B with P(A)not equal to 0 and P(B)not equal to 0 for which A and B are both independent and mutually exclusive. (e) TRUE / FALSE Var(X+Y) = Var(X)...
1.Simplify the following functions using ONLY Boolean Algebra Laws and Theorems. For each resulting simplified function,...
1.Simplify the following functions using ONLY Boolean Algebra Laws and Theorems. For each resulting simplified function, sketch the logic circuit using logic gates. (30points) a.SimplifyF= (A+C+D)(B+C+D)(A+B+C) Hint:UseTheorem8 ,theorem 7 and distributive ̅̅b. Show that (Z + X)(Z +Y)(Y + X) = ? ? + ? ? ̅̅c. Show that (X +Y)Z + XYZ = ?.? (15 points for simplification and 15 points for Logisim diagrams) 2. Prove the below equation using Boolean Algebra Theorems and laws Write the name of...
Use Boolean algebra to simplify the following expression to obtain the minimum cost implementation: ( !x...
Use Boolean algebra to simplify the following expression to obtain the minimum cost implementation: ( !x * !y * !w) + ( !x * !y * z) + ( !x * z * !w) + ( y * !z * w) + ( x * !y * !z)
Let A and B be true, X, Y, and Z false. P and Q have unknown...
Let A and B be true, X, Y, and Z false. P and Q have unknown truth value. Please, determine the truth value of the propositions in problem 1. Please, show the process of calculation by using the letter ‘T’ for ‘true,’ ‘F’ for ‘false,’ and ‘?’ for ‘unknown value’ under each letter and operator. Please underline your answer (truth value under the main operator) and make it into Bold font 1.  [ ( Z ⊃ P ) ⊃ P ]...
True or false? and explain please. (i) Let Z = 2X + 3. Then, Cov(Z,Y )...
True or false? and explain please. (i) Let Z = 2X + 3. Then, Cov(Z,Y ) = 2Cov(X,Y ). (j) If X,Y are uncorrelated, and Z = −5−Y + X , then V ar(Z) = V ar(X) + V ar(Y ). (k) Let X,Y be uncorrelated random variables (Cov(X,Y ) = 0) with variance 1 each. Let A = 3X + Y . Then, V ar(A) = 4. (l) If X and Y are uncorrelated (meaning that Cov[X,Y ] =...
Give one possible value of x that will make the following boolean expression true. (x>4 &&...
Give one possible value of x that will make the following boolean expression true. (x>4 && x<-1) || !(x==3)
Python questions 1) Mark true or false according to the following functions below. a) f(x) =...
Python questions 1) Mark true or false according to the following functions below. a) f(x) = a1 + a2x + a3x^2 is linear in x b) f(x) = a1 + a2x + a3x^2 is linear in the ai for i = 1, 2, 3 c)  f(x, y) = x log(y) is linear in x d)  f(x, y) = x log(y) is linear in y 2) What order does the interpolating polynomial through 6 points have? 3) For this problem, you have measured...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT