Question

In: Computer Science

x is 5, what is the result of the following Boolean expressions: 1. x != 0  ...

x is 5, what is the result of the following Boolean expressions:

1. x != 0  

2. x > 0  

3. x != 0

4. x > 0

5. (x >= 0) || (x < 0)

6. (x != 1) == !(x == 1)

7. (true) && (3 > 4)

True or False?

Please explain how you got your answers. I've been struggling with Boolean expressions so I'd like a little bit more of an explanation as to why each expression yields a certain answer.

Solutions

Expert Solution

1. x!=0

It will give true. ! mean not. so expresssion mean x is not equal to 5 which is true as 5 is not equal to 1.

2.x>0

It will give true as > mean greater then so 5 is greater then 0, it will yield true.

3. x!=0

It will give true. ! mean not. so expresssion mean x is not equal to 5 which is true as 5 is not equal to 1.

4.x>0

It will give true as > mean greater then so 5 is greater then 0, it will yield true.

5. (x >= 0) || (x < 0)

It will give true. || mean OR which give result true is either left expression of || is true or right expression of || is true. if any of them is true, final reuslt will be true. if both are flase, then only final result will be false. here left side if x>=0 which is true as 5 is greater then equal to 0. right side is false as 5 is not less then 0. As left is true, so final result will be true.

6. (x != 1) == !(x == 1)

It will give true. As lesft side of == is x!=1 (as 5 is not equal to 1) which is true and rigth side of == is !(x==1) which is also true (x==1 is false but ! convert true into false and false into true so will convert false into true). as true == true, so final result is true.(NOTE == is comparision operator and return true if both side has same value as 'true' in our case)

7. (true) && (3 > 4)

It will give false. && is Logical and operator which will resultin true only if both side(left and right) of && are true other wise give false. so as left side is true and rigth side is false(as 3 is not greater then 4). so final result will be false.


Related Solutions

1. Use Boolean algebra to simplify the following Boolean expressions to expressions containing a minimum number...
1. Use Boolean algebra to simplify the following Boolean expressions to expressions containing a minimum number of literals: (a) A’C’ + A’BC + B’C (b) (A + B + C)’(ABC)’ (c) ABC’ + AC (d) A’B’D + A’C’D + BD (e) (A’ + B)’(A’ + C’)’(AB’C)’ (f) (AE + A’B’)(C’D’ + CD) + (AC)’ 2. Obtain the truth table of the function F = (AB + C)(B + AC), express the function F in sum-of-minterms and product-of-maxterms forms, and express...
Simplify the following Boolean expressions to the minimum number of terms using the properties of Boolean...
Simplify the following Boolean expressions to the minimum number of terms using the properties of Boolean algebra (show your work and write the property you are applying). State if they cannot be simplified A. X’Y + XY B. (X + Y)(X + Y’) C. (A’ + B’) (A + B)’ D. ABC + A’B + A’BC’ E. XY + X(WZ + WZ’)
Simplify the following Boolean expressions to the minimum number of terms using the properties of Boolean...
Simplify the following Boolean expressions to the minimum number of terms using the properties of Boolean algebra (show your work and write the property you are applying). State if they cannot be simplified. A. A’B + AB B. XY + X(WZ + WZ’) C. X’Y’(X’+Y)(Y’+Y) D. ABC + A’B + A’BC’ E. (A+B)(AC+AC’)+AB+B Draw the circuit logic diagrams for both the original and simplified expressions.
Lab 7. Boolean Expressions a) Write a program that evaluates the following expressions. Assign reasonable values...
Lab 7. Boolean Expressions a) Write a program that evaluates the following expressions. Assign reasonable values to the variables. Print the results. a<b≥c , √a−7 b2 ≠c , d∨e∧f , a<b∨¬d ∧means and, ∨means inclusive or, ¬ means not. b) Write a program that asks a user whether he or she wants to become a Java programmer and determines if the user typed “yes” (Print true if yes and false otherwise.) Don't use the if statement here
Determine the value, true or false, of each of the following Boolean expressions, assuming that the...
Determine the value, true or false, of each of the following Boolean expressions, assuming that the value of the variable count is 0 and the value of the variable limit is 10. Give your answer as one of the values true or false. a. (count == 0) && (limit < 20) b. count == 0 && limit < 20 c. (limit > 20) || (count < 5) d. !(count == 12) e. (count == 1) && (x < y) f....
Evaluate the following expressions: (int)(18.357 * 100)/10 result: _____________ (int)18.357 * 100/10.0 result: _____________ int x...
Evaluate the following expressions: (int)(18.357 * 100)/10 result: _____________ (int)18.357 * 100/10.0 result: _____________ int x = 5; int y = 8; int z = ++x - y--; x=_____ y=_____ z=_____ int a = 20; int b = 10; a -= b - 15; a=_____ b=_____   CSE 118 Fundamentals of programming Java 14.0
1. Consider the following function F(x) = {2x / 25 0<x<5            {0 otherwise a) Prove...
1. Consider the following function F(x) = {2x / 25 0<x<5            {0 otherwise a) Prove that f(x) is a valid probability function. b) Develop an inverse-transformation for this function. c) Assume a multiplicative congruential random number generator with parameters: a: 23, m: 100, and xo: 17. Generate two random variates from the function for (x).
This assignment will acquaint you with the use of while loops and boolean expressions. You will...
This assignment will acquaint you with the use of while loops and boolean expressions. You will create a program that acts as a score keeper of a racquet ball game between two players. The program will continually ask the user who the winner of every point is as the game is played. It will maintain the scores and declare the match is over, using these rules: (1) A game is over when a. one of the players wins 7 points...
1.    Given the Utility function U(X,Y) = X.5 + Y.5 a.    Write mathematical expressions for marginal utility of...
1.    Given the Utility function U(X,Y) = X.5 + Y.5 a.    Write mathematical expressions for marginal utility of x and marginal utility of y b.    Does the consumer the assumption of non-satiation (more is better) desire more of x and y? c.    If the quantity of Y is held constant, does the marginal utility of x increase, remain constant or diminish as x increases? Prove your answer d.    Derive an expression for the marginal rate of substitution of x for y. e.    If Price of X...
1. Simplify the following expressions using Boolean algebra. a.A+AB b.AB+AB' c.A'BC+AC d.A'B+ABC'+ABC
1. Simplify the following expressions using Boolean algebra. a.A+AB b.AB+AB' c.A'BC+AC d.A'B+ABC'+ABC
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT