
U2L1-2 Review ^^
Presentation
•
Computers
•
9th - 10th Grade
•
Medium
TIFFANY WONG
Used 10+ times
FREE Resource
7 Slides • 9 Questions
1
U2L1-2 Review ^^
Presented by kaufwong©
2
Multiple Select
Which of the following are GLOBAL variables? Choose one or more.
3
Global vs. Local Variables
A global variable is one that ALL sprites and scripts can access.
shopping list is a global variable. The sprites "add," "clear," and "delete" all access shopping list and make changes to it.
4
Global vs. Local Variables
A local variable is limited to the scope in which its defined.
In other words, secret number can ONLY be used in the definition of number guessing game.
If you try to use secret number outside of number guessing game, you'll get an error.
5
More on local variables
We use local variables because using global variables sometimes makes it difficult to debug.
Having too many global variables also clutters our variable palette...
So when you're wondering if it should use a global or local variable, ask: do multiple scripts/sprites need to use it??
vs
6
Multiple Select
Which of the following are LOCAL variables? Choose one or more.
7
More on local variables
Yes, input variables are also local!
They cannot be used outside of the procedure in which they are defined.
8
Fill in the Blanks
When is using a local variable preferred (over using a global variable)?
Type answer...
9
Fill in the Blanks
When should you use a global variable instead of a local variable?
Type answer...
10
Multiple Select
In which of the following instances should you use global variables instead of local variables? Choose one or more.
Keeping track of a player's score throughout an event-based game with many different triggers
Making an abstraction called "pythagorean thm" that takes in two numbers and calculates the third side
Making an app that manages a to-do list with various sprites as buttons that each have a different feature
Counting the number of times the user makes a guess, but the variable is used only in this script
11
Variables vs Lists
A list can hold more than one value at a time, and the values are ordered. A variable can only hold one value at a time.
Shopping list app is very hard to do with just variables :(
You don't know how many variables you need to create because you need one for every item the user will add (and who knows how many they'll add!). A list is better because it can hold as many values as the user wants to add.
12
Multiple Choice
Running which of the following scripts will result in shopping list being an empty list?
13
Multiple Select
Running which of the following scripts will make the sprite say "0" ? Choose one or more.
14
Multiple Choice
shopping list = [eggs, milk, bread]. Which of the following will make shopping list [eggs, milk, cheese, bread] ?
15
The index of an item in the list refers to its order in the list.
shopping list = [eggs, milk, bread]
The first item, eggs, is at index 1
The length of the list refers to the number of items inside.
We want [eggs, milk, cheese, bread]
add adds items to the end, i.e. append in pseudocode
16
Multiple Choice
The delete blocks takes in a number and a list as inputs. Which of the following scripts will delete bread from the shopping list?
U2L1-2 Review ^^
Presented by kaufwong©
Show answer
Auto Play
Slide 1 / 16
SLIDE
Similar Resources on Wayground
10 questions
Geometry Medians and Altitudes
Presentation
•
9th - 10th Grade
10 questions
Earths Interior
Presentation
•
9th - 10th Grade
10 questions
KABEL LAN
Presentation
•
10th Grade
11 questions
Interior & Exterior Angles of Polygons
Presentation
•
9th - 11th Grade
11 questions
Linear Inequality Symbols + Graphs
Presentation
•
9th Grade
11 questions
Inverse Functions
Presentation
•
10th Grade
11 questions
Arc Length and Sector Area
Presentation
•
9th Grade
10 questions
System of Linear Inequalities
Presentation
•
9th Grade
Popular Resources on Wayground
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
6 questions
Rule of Law
Quiz
•
6th - 12th Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
10 questions
Movie Trivia
Quiz
•
KG - 2nd Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade
Discover more resources for Computers
16 questions
Module 1 Topic 2 Vocabulary Test
Quiz
•
9th - 12th Grade
25 questions
Unit 1 Quiz #1
Quiz
•
9th Grade
10 questions
Navigating Digital Citizenship and Online Safety
Interactive video
•
6th - 10th Grade
18 questions
[AP CSP] Python Coding: Conditionals + List + Algo Dev
Quiz
•
9th - 12th Grade
20 questions
Early Computing
Quiz
•
7th - 12th Grade