Lecture 7 Flashcards

1
Q

What is a variable in Scratch? Provide an example of something you might use one for.

A

Variables: a method of storing information while the program is running.

A variable is a single piece of information stored in the memory of Scratch. They can hold one value at a time.

They together, they are called “Lists”.

They could be used to find the score of game or calculate the velocity of a falling object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Draw and appropriately label the X,Y grid used for positioning on Scratch’s stage, add a sprite (your choice) to approx. position (-50,90)

A

A. (Upper Left Corner)

The viewable portion of stage goes from (-240 -240) for x and (-180 180) for y

Each point on the grid is a pixel point

(0,0) is the middle point.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe a Forever loop in Scratch, give an example of a situation where you might use it, and explain why you would use a Forever loop rather then another looping structure.

A

A forever loop is an infinite repetition structure.

There are other repetition structures such as the numeric to repeat a specific number of times.

The conditional to repeat until a condition is true.

When wanting to make something play forever in the project we use forever loop. Such as using it to make a cat meow every second.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is message broadcasting and how is it used in Scratch?

A

In games or animation it might be important for a sprite to trigger another sprite’s behavior which is done by broadcasting a message.

When the sprites receive the broadcasted does not have an effect on what happens it’s just used for code readability.

If more than one sprite receives the some message, they will all begin their tasks simultaneously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the purpose of a conditional statement. Give an example of a block in scratch that serves this purpose, and what you might use it for.

A

A conditional statement asks questions about the program state to choose from many commands.

It evaluates points if they are right or wrong and execute if the statement is true.

If… Then statement allows one set of statements to execute if the condition is true and another set to execute if the condition is wrong.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly