15
PC Basics Boolean Logic and Operators

Boolean Logic and Operators

  • Upload
    nydia

  • View
    70

  • Download
    0

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 Presentation

Citation preview

Page 1: Boolean Logic and Operators

PC Basics

Boolean Logic and

Operators

Page 2: Boolean Logic and Operators

PC Basics

Today’s Learning Objective• What we mean by truth values

• What we mean by Boolean Operators

• How to use AND, OR and NOT• How computers use these ideas!

Page 3: Boolean Logic and Operators

LOPC Basics

Truth Values

Learn how to figure out Boolean Logic

Hello Bill how ya doin?

Not bad Steve but my hard drive’s

playing up a bit.

Some statements can be seen to be either true or falseFor example…• you are in a Computing lesson• this slide has a white background• it is the weekendOther statements are a matter of opinion, e.g.• it’s warm today• that’s a nice hat you’re wearingFor this lesson, we will only considered statements about which everyone will agree

TRUE

TRUE

FALSE

Page 4: Boolean Logic and Operators

LOPC Basics

Boolean Operators• Arithmetic operators, e.g. +, -, X and ÷, tell us how

to combine two numbers• Everyone agrees on the results – e.g. 2 + 3 = 5• Boolean (also called logical) operators tell us how to

combine truth values in a standard way• You might also have seen them used in database

searches• Boolean operators include:

– NOT– AND– OR

Learn how to figure out Boolean Logic

Page 5: Boolean Logic and Operators

LOPC Basics

NOT

Learn how to figure out Boolean Logic

The NOT operator toggles the truth value to its opposite value, e.g.• NOT true = false• NOT false = trueFor example…• you are NOT in a Computing lesson• this slide’s background is NOT blue• it is NOT Friday

FALSE

FALSE

TRUE

Page 6: Boolean Logic and Operators

LOPC Basics

OR

Learn how to figure out Boolean Logic

The OR operator gives a true result if any of the input values is true, e.g.• false OR false = false• false OR true = true• true OR false = true• true OR true = trueFor example…• it is Saturday OR Sunday• it is a weekday OR a weekend• it is Monday OR this is a Computing lesson

FALSE

TRUE

TRUE

Page 7: Boolean Logic and Operators

LOPC Basics

AND

Learn how to figure out Boolean Logic

The AND operator gives a true result if everything is true, e.g.• false AND false = false• false AND true = false• true AND false = false• true AND true = trueFor example…• it is evening AND it is Monday• this slide is whiteAND the text is black• it is Monday AND this is a Computing lesson

FALSE

FALSE

TRUE

Page 8: Boolean Logic and Operators

LOPC Basics

Is Anything Always True?

Learn how to figure out Boolean Logic

Are there operations that are always true (or false)?• X OR NOT X is always true, e.g.

– it is Monday OR NOT Monday– this slide is blue OR NOT blue

• X AND NOT X is always false, e.g.– it is Monday AND NOT Monday– this slide is white AND NOT white

• Think about this next time you hear someone say, “…whether or not…”!

FALSE

FALSE

Page 9: Boolean Logic and Operators

LOPC Basics

What About Computers?

Learn how to figure out Boolean Logic

• Computers don’t 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 = 1– false = off = 0

• False and true are also often represented by zero and non-zero numbers when programming.

FALSE

FALSE

Page 10: Boolean Logic and Operators

LOPC Basics

Logic Circuits

Learn how to figure out Boolean Logic

ANDit is dark

motion detectedlight

NXOR landing light

upstairs switch

downstairs switch

• The above circuit could operate a landing light (you could use OR if they were push switches)

Page 11: Boolean Logic and Operators

LOPC Basics

Combining Operators• Just like BODMAS or BIDMAS for Maths, there is a

correct order to perform AND and OR• AND is often written as a dot – e.g. A AND B could

be written as A.B – and is done first, like multiplication in Maths

• OR is often written as a + - e.g. A OR B could be written as A+B – and is done second, like addition

• e.g. with A OR B AND C you would do the AND first and then the OR

• You can also use brackets, e.g. (A OR B) AND C

Learn how to figure out Boolean Logic

Page 12: Boolean Logic and Operators

LOPC Basics

Task• Use 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 numbers

Page 13: Boolean Logic and Operators

LOPC Basics

Extension Task• Play the Binary Game yourself and

see what score you get:

forums.cisco.com/CertCom/game/binary_game.swf

Learn how to decode binary numbers

Page 14: Boolean Logic and Operators

PC Basics

Today’s Learning Objective

• “Learn how to decode binary numbers”.

• Put or onto your Self Assessment sheet to show whether or not you have achieved today’s learning objective.

Page 15: Boolean Logic and Operators

PC Basics

ANDit is dark

motion detectedlight

NXOR landing light

upstairs switch

downstairs switch

• The above circuit could operate a landing light (you could use OR if they were push switches)