KS3 Computing/Logic/Boolean

What is Boolean Logic?

edit

Boolean logic is used to help us create more complex programs. They allow us to trigger actions depending on whether certain conditions are met. Consider what you would wear if it was sunny AND warm. What about if it was cold OR raining? And if it was NOT more than 2 degrees? Boolean logic has two states: True (denoted by 1) or False (denoted by 0).

Activity: going to the cinema

edit

Four friends are planning a trip to the cinema. Each of them has a different preference:

  • Armina wants to see an animated film
  • Boris does NOT want to see a high school movie
  • Cody wants to see a film with hero kids OR superheroes
  • Derren wants to see a film with action AND comedy

Here are the films playing at their local cinema:

  • Big Hero 6: action, comedy, animated, hero kids
  • Frozen: animated
  • Hunger Games: Mockingjay: action, hero kids
  • The Hobbit: action
  • Night at the Museum: comedy, action
  • The DUFF: high school, comedy
  • Captain America: superheroes, action

Questions

edit

Would Armina watch The Hobbit?

Answer:

No.


Would Boris watch The Hobbit?

Answer:

Yes.


Would Cody watch Captain America?

Answer:

Yes.


Which film(s) would Derren watch?

Answer:

Big Hero 6, Night at the Museum.


Would Armina and Boris watch Frozen?

Answer:

Yes.


Would Boris and Cody watch Hunger Games: Mockingjay?

Answer:

Yes.


Would Cody and Derren watch Hunger Games: Mockingjay?

Answer:

No.


Can you draw a truth table for each of the friends? (See KS3_Computing/Logic/And, KS3_Computing/Logic/OR, KS3_Computing/Logic/NOT for help


Write a simple program or algorithm that decides whether all four kids will watch a film.


Use your program to identify which film(s) will they all watch

Answer:

Big Hero 6.