Question

In: Computer Science

Evaluate the truth values of the following conditions given the values of the declared variables. NOTE:...

  1. Evaluate the truth values of the following conditions given the values of the declared variables. NOTE: Conditions formed using relational or equality operators (>, <, >=, <=, ==, !=) are relational conditions. Conditions formed using logical operators [&& (AND), || (OR), & (boolean AND), | (boolean inclusive OR), ^ (boolean exclusive OR) are complex conditions.

Variables

boolean gameLoss = false;

int points = 15;

boolean championship = false;

Conditions: Evaluate then Indicate the truth value produced by the relational conditions and the joins. NOTE: Change in variable values do not carry over to next evaluation.

Truth Value of Complex Conditions

gameLoss && championship || points > 15

gameLoss && championship || points > 15

FALSE

FALSE

gameLoss && (championship == false) && (points >= 15)

!(championship && gameLoss && (points > 30))

gameLoss = true;

gameLoss & !(championship & (points != 15))

gameLoss ^ championship || (points == 15)

points = 35;

(gameLoss || championship) && (points > 29))

gameLoss & championship | (points == 43)

!gameLoss | (championship ^ (points >= 15))

Variables

int bowlGames = 9;

double avgPrice = 3890.00;

int maxQBWins = 6;

Conditions: Evaluate then Indicate the truth value produced by the relational conditions and the joins. NOTE: Change in variable values do not carry over to next evaluation.

Truth Value of Complex Conditions

(maxQBWins > 2) && (avgPrice > 3000.00) |

(++bowlGames >= 2)

(bowlGames > 4) || (avgPrice >= 3890.00) &&

!(maxQBWins < 9)

maxQBWins = 8

(bowlGames >= 4) & (avgPrice != 3890.00) ||

!(maxQBWins < 8)

Solutions

Expert Solution

Variables

boolean gameLoss = false;

int points = 15;

boolean championship = false;

Conditions: Evaluate then Indicate the truth value produced by the relational conditions and the joins. NOTE: Change in variable values do not carry over to next evaluation.

Truth Value of Complex Conditions

gameLoss && championship || points > 15

gameLoss && championship || points > 15

FALSE

FALSE

gameLoss && (championship == false) && (points >= 15)

FALSE

!(championship && gameLoss && (points > 30))

TRUE

gameLoss = true;

gameLoss & !(championship & (points != 15))

TRUE

gameLoss ^ championship || (points == 15)

TRUE

points = 35;

(gameLoss || championship) && (points > 29))

FALSE

gameLoss & championship | (points == 43)

FALSE

!gameLoss | (championship ^ (points >= 15))

TRUE

Variables

int bowlGames = 9;

double avgPrice = 3890.00;

int maxQBWins = 6;

Conditions: Evaluate then Indicate the truth value produced by the relational conditions and the joins. NOTE: Change in variable values do not carry over to next evaluation.

Truth Value of Complex Conditions

(maxQBWins > 2) && (avgPrice > 3000.00) |

(++bowlGames >= 2)

TRUE

(bowlGames > 4) || (avgPrice >= 3890.00) &&

!(maxQBWins < 9)

TRUE

maxQBWins = 8

(bowlGames >= 4) & (avgPrice != 3890.00) ||

!(maxQBWins < 8)

TRUE

Related Solutions

1. in the code below, 2 variables (largest and smallest) are declared. use these variables to...
1. in the code below, 2 variables (largest and smallest) are declared. use these variables to store the largest and smallest of three integer values. you must decide what other variables you will need and initialize them if appropriate. 2. write the rest of the program using assignment statements, if statements, or if else statements as appropriate. There are comments in the code that tell you where you should write your statements 3. compile and execute. Output should be: The...
8.   Create a truth table and determine the results for the following equation and values Equation :...
8.   Create a truth table and determine the results for the following equation and values Equation : bool b = ((a+4< 7) || ((b-a > 10) && !(c*a == 8))) Values :   a = 2; b = 8; c = 4 9. Write a program using Atom and submit via Blackboard. a. Request an integer whole dollar amount from the console. b. Using the least amount of bills ($50,$20,$10,$5,$1) necessary, calculate how many of each bill type you will need to get...
in your own words, explain the concept of "post-truth." Evaluate the implications of the "post-truth era"...
in your own words, explain the concept of "post-truth." Evaluate the implications of the "post-truth era" for democratic politics. If you were the media consultant to a statewide, up-ballot candidate campaign--e.g., governor--in this "post-truth era," what might be some crucial elements of your media strategy?
Which discipline (ex. humanities) values objectivity and truth?
Which discipline (ex. humanities) values objectivity and truth?
state the critical values for a two-independent same t-test given the following conditions: a. two-tailed test...
state the critical values for a two-independent same t-test given the following conditions: a. two-tailed test a=.01, total df=26 b. one-tailed test, lower tail critical a=.01,df=15 for each group c. two- tailed test, a=.05, n=12 in each group d.one-tailed test, upper tail critical, a=.05 n for both groups combined is 30
Explain in detail, in your own words, what the following statements mean (suppose variables are declared...
Explain in detail, in your own words, what the following statements mean (suppose variables are declared and initialized: x declared as double, ch declared as char, s declared as string). Q3.1 ifstream input("numbers.txt"); Q3.2 ++num; Q3.3 static_cast(x); Q3.4 bool b2 = 0; Q3.5 srand(time(0)); Q3.6 floor(x); Q3.7 isupper(ch)); Q3.8 cout << s[0] << endl; Q3.9 cout << setw(9) << x; Q3.10 cout << setprecision(3) << x << "\n ";
Assume that the following variables have been declared: String a = “Ready, Set, Go!”; String b...
Assume that the following variables have been declared: String a = “Ready, Set, Go!”; String b = a.substring(5, 10); char b1 = b.charAt(2); Evaluate the following expression: 1. Character.isLowerCase(b1) 2. b1 + 5 3. b + 5 4. Character.toLowerCase(b1) 5. a.charAt(2 + a.indexOf(“e”))
For the following types of values, designate discrete variables (D) and continuous variables (C): (a) weight...
For the following types of values, designate discrete variables (D) and continuous variables (C): (a) weight of the contents of a package of cereal, (b) diameter of a bearing, (c) number of defective items produced, (d) number of individuals in a geographic area who are collecting unemployment benefits, (e) the average number of prospective customers contacted per sales representative during the past month, (f) dollar amount of sales.
What are the differences between espoused (publicly declared) values and values in use (the unwritten rules...
What are the differences between espoused (publicly declared) values and values in use (the unwritten rules that actors follow)?
Given specific contract procurement conditions for a project, evaluate the factors that influence a contract pricing...
Given specific contract procurement conditions for a project, evaluate the factors that influence a contract pricing strategy and recommend the strategy that is best suited for the given conditions.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT