# boolean logic and operators

Post on 23-Feb-2016

41 views

Embed Size (px)

DESCRIPTION

Boolean Logic and Operators. Today’s Learning Objective. What we mean by truth values What we mean by Boolean Operators H ow to use AND, OR and NOT How computers use these ideas!. Truth Values. Some statements can be seen to be either true or false For example… - PowerPoint PPT PresentationTRANSCRIPT

Slide 1

Boolean Logic and OperatorsPC BasicsTodays Learning ObjectiveWhat we mean by truth valuesWhat we mean by Boolean OperatorsHow to use AND, OR and NOTHow computers use these ideas!PC BasicsTruth ValuesLearn how to figure out Boolean LogicHello Bill how ya doin?Not bad Steve but my hard drives playing up a bit.Some statements can be seen to be either true or falseFor exampleyou are in a Computing lessonthis slide has a white backgroundit is the weekendOther statements are a matter of opinion, e.g.its warm todaythats a nice hat youre wearingFor this lesson, we will only considered statements about which everyone will agree

TRUETRUEFALSELOPC BasicsBoolean OperatorsArithmetic operators, e.g. +, -, X and , tell us how to combine two numbersEveryone agrees on the results e.g. 2 + 3 = 5Boolean (also called logical) operators tell us how to combine truth values in a standard wayYou might also have seen them used in database searchesBoolean operators include:NOTANDORLearn how to figure out Boolean LogicLOPC BasicsNOTLearn how to figure out Boolean LogicThe NOT operator toggles the truth value to its opposite value, e.g.NOT true = falseNOT false = trueFor exampleyou are NOT in a Computing lessonthis slides background is NOT blueit is NOT Friday

FALSEFALSETRUELOPC Basics5ORLearn how to figure out Boolean LogicThe OR operator gives a true result if any of the input values is true, e.g.false OR false = falsefalse OR true = truetrue OR false = truetrue OR true = trueFor exampleit is Saturday OR Sundayit is a weekday OR a weekendit is Monday OR this is a Computing lesson

FALSETRUETRUE

LOPC Basics6ANDLearn how to figure out Boolean LogicThe AND operator gives a true result if everything is true, e.g.false AND false = falsefalse AND true = falsetrue AND false = falsetrue AND true = trueFor exampleit is evening AND it is Mondaythis slide is whiteAND the text is blackit is Monday AND this is a Computing lesson

FALSEFALSETRUE

LOPC Basics7Is Anything Always True?Learn how to figure out Boolean LogicAre there operations that are always true (or false)?X OR NOT X is always true, e.g.it is Monday OR NOT Mondaythis slide is blue OR NOT blueX AND NOT X is always false, e.g.it is Monday AND NOT Mondaythis slide is white AND NOT whiteThink about this next time you hear someone say, whether or not!FALSEFALSELOPC Basics8What About Computers?Learn how to figure out Boolean LogicComputers dont understand the idea of truth, but they can detect whether a circuit or switch is on or off.Circuits being on and off can also represent 1 and 0 as we learnt in the binary lesson.When designing logic circuits for computers:true = on = 1false = off = 0False and true are also often represented by zero and non-zero numbers when programming.FALSEFALSELOPC Basics9Logic CircuitsLearn how to figure out Boolean LogicANDit is darkmotion detectedlight

NXORlanding lightupstairs switchdownstairs switchThe above circuit could operate a landing light (you could use OR if they were push switches) LOPC Basics10Combining OperatorsJust like BODMAS or BIDMAS for Maths, there is a correct order to perform AND and ORAND is often written as a dot e.g. A AND B could be written as A.B and is done first, like multiplication in MathsOR is often written as a + - e.g. A OR B could be written as A+B and is done second, like additione.g. with A OR B AND C you would do the AND first and then the ORYou can also use brackets, e.g. (A OR B) AND CLearn how to figure out Boolean LogicLOPC BasicsTaskUse the help sheet called Decoding Binary Numbers to decode the secret message that has been emailed to you.

Copy and paste the email into a Word document and write the real message underneath.Learn how to decode binary numbersLOPC BasicsExtension TaskPlay the Binary Game yourself and see what score you get:

forums.cisco.com/CertCom/game/binary_game.swfLearn how to decode binary numbersLOPC BasicsTodays Learning ObjectiveLearn how to decode binary numbers.

Put or onto your Self Assessment sheet to show whether or not you have achieved todays learning objective.PC BasicsANDit is darkmotion detectedlight

NXORlanding lightupstairs switchdownstairs switchThe above circuit could operate a landing light (you could use OR if they were push switches) PC Basics