Computer Science > QUESTIONS & ANSWERS > Engineering & Technology Computer Science Write the truth table for boolean expression, p1 || (!(p (All)
Question Answered step-by-step 1. Write the truth table for boolean expression, p1 || (!(p2 && p3) && p4). 2. Write the expression (prove with truth table) to build a ham sandwich with or without... egg. p1, egg p2, ham p3, bread For example, expression, (p2 && p3 && ~p1), will build a ham sandwich without egg Reference: Not operation, ! true -> !(true) -> false false -> !(false) -> true Comparator, age = 24 age > 18 -> 24 > 18 -> true !(24 > 18) -> !(true) -> false age = 17 age > 18 -> 17 > 18 -> false !(false) -> true age <= 18 -> 17 <= 18 -> true weight = 140 (weight < 140) -> 140 < 140 -> false AND Operation, && age = 24, weight =140 (age > 18) && (weight < 140) -> (24 > 18) && (140 < 140) -> true && false -> false Truth Table, variables (true/false), all combination of possible conditions. p1, p2 -> 2 boolean variable, the total possible combination will be 2^2 = 4 p1, p2, p3 -> 2 boolean variable, the total possible combination will be 2^3 = 2*2*2 = 8 p1, p2,...pn -> n bollean variable, the total possible combination will b 2^n p1 p2 p1 && p2 0 0 0 0 1 0 1 0 0 1 1 1 p1 && p2 && p3 -> (p1 && p2) && p3 p1 p2 p3 (p1 && p2)->x (x && p3) 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 1 1 OR operation, age = 24, weight =140 (age > 18) || (weight < 140) -> (24 > 18) || (140 < 140) -> true || false -> true p1 p2 p1 || p2 0 0 0 0 1 1 1 0 1 1 1 1 p1 || p2 || p3 -> (p1 || p2) || p3 p1 p2 p3 (p1 || p2)->x (x || p3) p1 || p2 || p3 (lazy evaluation) 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 (p1 && p2) || p3 p1 p2 p3 (p1 && p2)->x (x || p3) 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1 (p1 || p2) && p3 p1 p2 p3 (p1 || p2)->x (x && p3) 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 p3, bread p1, egg p2, ham expression to build a sandwich, (p1 || p2) && p3 Cereal Milk, (C || M) && M 0 0 0 0 1 1 1 0 0 1 1 1 [Show More]
Last updated: 2 years ago
Preview 1 out of 4 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Jul 20, 2021
Number of pages
4
Written in
This document has been written for:
Uploaded
Jul 20, 2021
Downloads
0
Views
147
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·