Search Header Logo
Boolean Values and Expressions

Boolean Values and Expressions

Assessment

Presentation

Computers

9th - 12th Grade

Practice Problem

Easy

Created by

Amy Soquet

Used 2+ times

FREE Resource

10 Slides • 21 Questions

1

Boolean Values and Expressions

Slide image

2

George Boole's work in logic and mathematics still lays the foundation for logic and modern computer circuitry.

3

His work was so important

  • He has a data type named after him!

  • This data type may store one of two values...

4

Multiple Select

What are the values that can be stored in a Boolean variable?

1

true

2

false

3

MAXINT

4

-MAXINT

5

Evaluate each of the Boolean expressions.

6

Multiple Choice

!false

1

True

2

False

7

Multiple Choice

8 + 9 < 72

1

True

2

False

8

Multiple Choice

(!true) || (! false)

1

true

2

false

9

Multiple Choice

(!(10 == 10)

1

True

2

False

10

Multiple Choice

true && false

1

true

2

false

11

Multiple Choice

true && (!false)

1

true

2

false

12

Multiple Choice

(8 * 7 > 100) || true

1

true

2

false

13

Multiple Choice

!( (4 > 8) && (10 < 1) )

1

true

2

false

14

Multiple Choice

int x = 12;

bool y = (x == 13);

What value is stored in y?

1

true

2

false

15

Multiple Choice

int w = -4;

int x = -2;

int y = 5;

int z = 0;

bool a = (x = y < z + 1);

What is stored in a?

1

true

2

false

16

Multiple Choice

int w = -4;

int x = -2;

int y = 5;

int z = 0;

bool a = (w > 5) || (z < 2);

What is stored in a?

1

true

2

false

17

Multiple Choice

int w = -4;

int x = -2;

int y = 5;

int z = 0;

bool a =( (w > 5) || (z < -2) || (z > -1));

What is stored in a?

1

true

2

false

18

Multiple Choice

int a = 12;

int b = 14;

if ((a < 12) && (b > 10))

{ cout<<"Hello"; }

else

{ cout<<"Goodbye";}

What is output as a result of executing this code segment?

1

Hello

2

Goodbye

19

Open Ended

Write a section of code to represent the following:


w is less than 10

20

w < 10

How did that one go?

21

Open Ended

Write a section of code to represent the following:


d is positive and greater than e

22

(d > 0) && (d > e)

23

Open Ended

Write a section of code to represent the following:


h is between 5 and 10, inclusive

24

(h >= 5) && (h <= 10)

25

Open Ended

Write a section of code to represent the following:


u is less than 0 or greater than 100

26

(u < 0) || (u > 100)

Be sure to use complete thoughts on both sides of the "or"

27

Open Ended

Write a section of code to represent the following:


m and n are both negative

28

(m < 0) && (n < 0)

Once again, be sure to use stand alone statements

29

Open Ended

Write a section of code to represent the following:


b is an odd number

30

We definitely have some choices here:

  • !( b % 2 == 0)

  • (b % 2 != 0)

  • (b % 2 == 1)

31

Poll

Rate your understanding of the Boolean expressions we just practiced. 4 is "I understand it well" and 1 is "I need more help"

1

2

3

4

Boolean Values and Expressions

Slide image

Show answer

Auto Play

Slide 1 / 31

SLIDE