4.3.2
Boolean Logic
Boolean Operators
Boolean Operators
Boolean operators perform logical operations on boolean variables and always return another boolean variable.
AND
AND
- AND evaluates to True (1) if and only if both operands are True (1).
- '.' is the symbol for the AND operator.
OR
OR
- OR evaluates to True (1) if any of the two operands are True (1).
- '+' is the symbol for the OR operator.
NOT (negation)
NOT (negation)
- NOT negates a logical value.
- The symbol for the NOT operator is a line above the variable.
- For example, NOT is written as .
XOR
XOR
- XOR means 'exclusive OR'.
- The symbol for the XOR operator is .
NAND
NAND
- NAND means NOT AND.
- NAND is written as .
NOR
NOR
- NOR means NOT OR.
- NOR is written as .
Evaluating Expressions
Evaluating Expressions
Logic gates can be combined to form logic circuits that process complex logical statements such as A AND (B OR C).
Evaluating boolean expressions
Evaluating boolean expressions
- To evaluate a boolean expression, you should substitute all of the values in for the variables and then use the definitions of the different boolean functions to simplify it one step at a time.
Order of evaluation
Order of evaluation
- You should evaluate any expression in brackets first, for example:
- NOT(True OR False).
- NOT(True).
- False.
Truth tables
Truth tables
- Another method of evaluating an expression is using a truth table.
- A truth table shows every possible combination of inputs and the resulting output.
- The truth table shows the input and output state for each combination.
- The table can then be used to look up the output.
Defining Problems Using Boolean Logic
Defining Problems Using Boolean Logic
It is possible to describe the various outcomes of particular scenarios using boolean logic. The outcomes can then be interpreted using logic gates in an electronic circuit.
Example 1
Example 1
- In order to pass an online course, students must achieve at least 75% in both assessments A and B.
Booelan logic
Booelan logic
- When approaching a problem like this, truth tables help to identify the possible outcomes.
- Whether or not a student passed can be expressed as:
Example 2
Example 2
- A reef supplement should be added if the calcium level drops below 400 ppm or the magnesium drops below 1300 ppm, and the temperature of the water is 24°C.
Booelan logic
Booelan logic
- Whether or not the supplement is added can be expressed as:
1Components of a Computer
1.1Structure & Function of the Processor
1.2Types of Processors
2Software & Software Development
2.1Systems Software
2.2Applications Generation
2.3Software Development
3Exchanging Data
3.1Compression, Encryption & Hashing
3.3Networks
4Data Types, Data Structures & Algorithms
4.1Data Types
5Legal, Moral, Cultural & Ethical Issues
5.1Computing Related Legislation
6Elements of Computational Thinking
6.1Thinking Abstractly
6.2Thinking Procedurally
6.3Thinking Logically
7Problem Solving & Programming
7.1Programming Techniques
7.2Programming Construction
Jump to other topics
1Components of a Computer
1.1Structure & Function of the Processor
1.2Types of Processors
2Software & Software Development
2.1Systems Software
2.2Applications Generation
2.3Software Development
3Exchanging Data
3.1Compression, Encryption & Hashing
3.3Networks
4Data Types, Data Structures & Algorithms
4.1Data Types
5Legal, Moral, Cultural & Ethical Issues
5.1Computing Related Legislation
6Elements of Computational Thinking
6.1Thinking Abstractly
6.2Thinking Procedurally
6.3Thinking Logically
7Problem Solving & Programming
7.1Programming Techniques
7.2Programming Construction
Unlock your full potential with GoStudent tutoring
Affordable 1:1 tutoring from the comfort of your home
Tutors are matched to your specific learning needs
30+ school subjects covered