Search Header Logo
Unit 5:  JavaScript and Graphics 5.1-5.8

Unit 5: JavaScript and Graphics 5.1-5.8

Assessment

Presentation

Computers

8th - 9th Grade

Medium

Created by

Mattea Barnes

Used 3+ times

FREE Resource

20 Slides • 21 Questions

1

Unit 5: JavaScript & Control Structures

5.1-5.8

Slide image

2

5.1 Booleans

Booleans refer to only two values and are used to test whether a specific condition is...

3

Multiple Select

A boolean is a ____ or ____ value.

1

true

2

false

3

yes

4

no

4

Question:

Describe how you would create a boolean variable that stores whether it is raining or not. What name would you give it? What value would you assign to it if it is raining?


5

Open Ended

Describe how you would create a boolean variable that stores whether it is raining or not. What name would you give it? What value would you assign to it if it is raining?

6

Poll

How confident are you in your understanding of booleans?

Super Confident

Somewhat Confident

No Confidence

7

5.2 Logical Operators

Logical operators allow you to connect or modify boolean expressions. There are three logical operators...

8

Fill in the Blanks

Type answer...

9

Fill in the Blanks

Type answer...

10

Fill in the Blanks

Type answer...

11

Review Questions

Answer the following questions about logical operators.

12

Multiple Choice

If the variable a is true, what is the value of !a?

1

True

2

False

13

Why is the answer false?

Let's discuss.

14

var a = true;

So !a is false.

a is now false because the ! in front of a means not, making it not true.

15

Multiple Choice

If the variable a is true and b is false, what is the value of a && b?

1

True

2

False

16

Why is the answer false?

Let's discuss.

17

If the variable a is true and b is false, what is the value of a && b?


The value is false because with the && logical operator, if both variables aren't true, then its value is false.

18

Multiple Choice

If the variable a is true and b is false, what is the value of a || b?

1

True

2

False

19

Why is the answer true?

Let's discuss.

20

If the variable a is true and b is false, what is the value of a || b?


The answer is true because if at least one value is true, then it's true. If they both have false, then it would be false.

21

Poll

How confident are you in your understanding of logical operators?

Super Confident

Somewhat Confident

With a little more practice, I'll have more confidence.

No Confidence

22

5.3 Comparison Operators

Comparison operators let you compare two values.

23

Multiple Select

Choose the correct comparison operators.

1

<=

2

>

3

=>

4

=

5

!=

24

Multiple Choice

12 >= 12

1

True

2

False

25

Multiple Choice

15 < 15

1

True

2

False

26

Multiple Choice

1 < 33

1

True

2

False

27

Multiple Choice

5 != 3

1

True

2

False

28

Poll

How confident are you in your understanding of comparison operators?

Super Confident

Somewhat Confident

With a little more practice, I'll have more confidence.

No Confidence

29

5.4 If Statements

If statements allow you to make decisions and execute specific code depending on the validity of a condition.

30

Fill in the Blanks

Type answer...

31

If Statements... let's discuss.

What are they?

Why are they useful?

How do you use them?

32

What is something you only do if you are wearing a helmet? What is something you only do if you are outdoors? Create propositional statements: “If __, then __

If I'm wearing a helmet, then I am biking.

If I'm outdoors, then I am going on a run.

33

So what boolean value would hasHelmet be assigned if I wanted to ride a bike?

....

34

var hasHelmet = true;

35

Open Ended

Why do you think if statements are useful?

36

Poll

How confident are you in your understanding of If Statements?

Super Confident

Somewhat Confident

With a little more practice, I'll have more confidence.

No Confidence

37

5.5-5.7: For Loops

For Loops allow us to do something for a set number of times.

38

Multiple Choice

How would I correctly print out Hello three times using a for loop?

1

println("Hello");

println("Hello");

println("Hello");

2

for(i =0; i > 3; i++){

println("Hello");

}

3

for(i =0; i < 3; i++){

println("Hello");

}

4

for(i =0; i < 3; i--){

println("Hello");

}

39

Multiple Choice

This code represents walking by taking several steps. Rewrite this using a for loop:

leftFoot();

rightFoot();

leftFoot();

rightFoot();

leftFoot();

rightFoot();

1

for(i =0; i <3; i++){

leftFoot();

rightFoot();

}

2

for(i = 1; i < 3; i++){

leftFoot();

rightFoot();

}

3

for(i =0; i <3; i++){

leftFoot();

rightFoot();

leftFoot();

rightFoot();

}

40

If I wanted to print out the values 0 - 10, what would my for loop look like?

41

WHICH ANSWER?

for(var i = 0; i < 11; i++)

for(var i = 0; i <= 10; i++)

Unit 5: JavaScript & Control Structures

5.1-5.8

Slide image

Show answer

Auto Play

Slide 1 / 41

SLIDE