Part 6: Boolean Logic Expressions Boolean expressions are types of logical operations that we can perform on true and false values. Note that the word Boolean is always capitalized because it was named after its inventor, George Boole. Boolean algebra is a very important topic in computer science, and if you haven't learned it before you definitely will in the future. However, for our purposes we are only interested in how we can use them to manipulate binary numbers. The way we use them on binary numbers is by treating 1 as true and 0 as false. From this point on I will be using 0 and 1 instead of false and true. There are many types of Boolean expressions, but the three most important ones are AND, OR, and NOT. AND takes 2 operands and will output 1 if they are both 1, or 0 otherwise OR takes 2 operands and will output 1 if either one is 1, or 0 if neither is 1 NOT takes 1 operand and reverses it: 1 becomes 0, and 0 becomes 1 We can represent this behavior using something called a truth table to show all possible outcomes: AND First operand Second operand Result 0 0 0 0 1 0 1 0 0 1 1 1   OR First operand Second operand Result 0 0 0 0 1 1 1 0 1 1 1 1   NOT Operand Result 0 1 1 0   Exercise 12: What is 1 AND 0?   We can also use these operations on larger binary numbers. The way we do so is the same as with other arithmetic: one column at a time. Unlike addition there is no chance of carried values, so we can perform Boolean operations from right-to-left or left-to-right and get the same result. For example, here is how we get the result of 1100 AND 1010:           1 1 0 0 AND 1 0 1 0           1 0 0 0 Leftmost column: 1 AND 1 = 1 Second column: 1 AND 0 = 0 Third column: 0 AND 1 = 0 Last column: 0 AND 0 = 0   The process is the same for OR:        1 1 0 0 OR 1 0 1 0        1 1 1 0 Leftmost column: 1 OR 1 = 1 Second column: 1 OR  0 = 1 Third column: 0 OR 1 = 1 Last column: 0 OR 0 = 0   For NOT, you just need to flip each bit: NOT 1 1 0 0           0 0 1 1   Exercise 13: What is 11101000 AND 01000001? Exercise 14: What is 11110000 OR 00001111? Exercise 15: Convert the number 128 to binary, then perform the NOT operation on it. What is the result?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Part 6: Boolean Logic Expressions

Boolean expressions are types of logical operations that we can perform on true and false values. Note that the word Boolean is always capitalized because it was named after its inventor, George Boole. Boolean algebra is a very important topic in computer science, and if you haven't learned it before you definitely will in the future. However, for our purposes we are only interested in how we can use them to manipulate binary numbers. The way we use them on binary numbers is by treating 1 as true and 0 as false. From this point on I will be using 0 and 1 instead of false and true.

There are many types of Boolean expressions, but the three most important ones are AND, OR, and NOT.

  • AND takes 2 operands and will output 1 if they are both 1, or 0 otherwise
  • OR takes 2 operands and will output 1 if either one is 1, or 0 if neither is 1
  • NOT takes 1 operand and reverses it: 1 becomes 0, and 0 becomes 1

We can represent this behavior using something called a truth table to show all possible outcomes:

AND
First operand Second operand Result
0 0 0
0 1 0
1 0 0
1 1 1

 

OR
First operand Second operand Result
0 0 0
0 1 1
1 0 1
1 1 1

 

NOT
Operand Result
0 1
1 0

 

Exercise 12: What is 1 AND 0?

 

We can also use these operations on larger binary numbers. The way we do so is the same as with other arithmetic: one column at a time. Unlike addition there is no chance of carried values, so we can perform Boolean operations from right-to-left or left-to-right and get the same result.

For example, here is how we get the result of 1100 AND 1010:

          1 1 0 0

AND 1 0 1 0

          1 0 0 0

Leftmost column: 1 AND 1 = 1

Second column: 1 AND 0 = 0

Third column: 0 AND 1 = 0

Last column: 0 AND 0 = 0

 

The process is the same for OR:

       1 1 0 0

OR 1 0 1 0

       1 1 1 0

Leftmost column: 1 OR 1 = 1

Second column: 1 OR  0 = 1

Third column: 0 OR 1 = 1

Last column: 0 OR 0 = 0

 

For NOT, you just need to flip each bit:

NOT 1 1 0 0

          0 0 1 1

 

Exercise 13: What is 11101000 AND 01000001?

Exercise 14: What is 11110000 OR 00001111?

Exercise 15: Convert the number 128 to binary, then perform the NOT operation on it. What is the result? 

Expert Solution
Step 1: Introduction

The three most important logic gates are AND, OR, and NOT.

1. AND takes 2 operands and will output 1 if they are both 1, or 0 otherwise

2. OR takes 2 operands and will output 1 if either one is 1, or 0 if neither is 1

3. NOT take 1 operand and reverse it: 1 becomes 0, and 0 becomes 1

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education