Concept explainers
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. (count < 10) || (x < y)
g. !( ((count < 10) || (x < y)) && (count >= 0) )
h. ((limit/count) > 7) || (limit < 20)
i. (limit < 20) || ((limit/count) > 7)
j. ((limit/count) > 7) && (limit < 0)
k. (limit < 0) && ((limit/count) > 7)
l. (5 && 7) + (!6)
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Concepts of Programming Languages (11th Edition)
Database Concepts (8th Edition)
Absolute Java (6th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Computer Science: An Overview (12th Edition)
- For each of the following statements, determine whether they are true or false. If false, write their logical negation (distributing the ¬ across any expressions as necessary) and explain how this negation is true. In each of these, x and y are assumed to be integers. (a) (∀x)(∀y)((y > x) ⇒ (x = 0)) (b) (∃x)(∀y)((y > x) ⇒ (x = 0)) (c) (∀x)(∃y)((y > x) ⇒ (x = 0)) (d) (∀x)(((∀y)(y > x)) ⇒ (x = 0))arrow_forwardTODO 3 Declare a Python boolean by declaring the variable t and setting it equal to True using the = symbol. Next, declare a Python boolean by declaring the variable f and setting it equal to False using the = symbol. CODE: # TODO 3.1 # TODO 3.2 todo_check([ (t == True,'t must be equal to True!'), (f == False,'f must be equal to False!'), ]) #Given two booleans we can perform different boolean operations such as "and" and "or". print(f"Check type of t using `type(t)`: {type(t)}") # Prints "<class 'bool'>" print(f"Logical AND: {t and f}") # Logical AND; prints "False" print(f"Logical OR: {t or f}") print(f"NOT or opposite of t value: {not t}") print(f"Logical XOR: {t != f}")arrow_forwardWrite the following compound statement in terms of the simple statements p, q, and r. "I go to office hours and ask questions, and my professor does not remember me." p: I go to office hours. q: I ask questions. r: My professor remembers me.arrow_forward
- Determine the truth value of the statement (~p ∨ q) ∨ (r ∧ q) using the following conditions. a) p is false, q is true, and r is true. b) p is true, q is false, and r is false. a) If p is false, q is true, and r is true, what is the value of (~p ∨ q) ∨ (r ∧ q)? True? False? b) If p istrue, q is false, and r is false, what is the value of (~p ∨ q) ∨ (r ∧ q)? True? False?arrow_forwardDetermine if the following statements are logically equivalent:p ∨ (q ∧ r),(p ∧ q) ∨ (p ∧ r)Variables: p,q,rarrow_forwardIf the statements p and q are both true while statement r is false. which of the following has a false truth value?* a. If r then (p or q). b. Not (r and (not p or q)). c. (p or r) if and only if not q. d. If not (r and q) then p.arrow_forward
- Evaluate the following logical expressions and answer if it's True or False, whereX=True, Y= false, Z= Falsea) Z|| (X && (Y||Z))b) !Y || (Z || !X)arrow_forwardThe following equations estimate the calories burned when exercising (source): Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Write a program with inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 49 155 148 60 the output is: Women: 580.94 calories Men: 891.47 caloriesarrow_forwardThe following equations estimate the calories burned when exercising (source): Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('Men: {:.2f} calories'.format(calories_man)) Ex: If the input is: 49 155 148 60 Then the output is: Women: 580.94 calories Men: 891.47 caloriesarrow_forward
- The following equations estimate the calories burned when exercising (source): Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('Men: {:.2f} calories'.format(calories_man)) Ex: If the input is: 49 155 148 60arrow_forwardAssume test is a boolean variable and x is an int variable , which of the following is not a correct Boolean expression? (test == true) && (x > 100) !(test) && (x > 0) (x > 0) || (x < 0) (x != 0) || (x = 0)arrow_forwardIf ai s false, b is true, and c is true,find the truth value of the statement. a → (b → c) Select the truth value of a → (b → c) when a is false, b is true, and c is true.Choose the correct answer below. True or False?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education