CSP U5l02 Activity Guide

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

CSP U5L02 Lists Investigate Activity Guide

Level 2​ - watch the video


____________________________________________________________

Pick ​EITHER​ ​the Outfit Picker app on ​Level 3​ OR​ the Band Namer app on ​Level 4​ to investigate
____________________________________________________________
If you selected ​Outfit Picker on Level 3​ answer these questions

1. Lines 1-2: Why does this program use two lists? What is each one storing?
○ One stores the random name the other one stores the button

2. Lines 4-5: Why does the is program include the variables ​topsIndex​ and ​bottomsIndex​? What
would happen if these variables were removed from the program?
○ IT would stop the 2 random words from appearing

3. Lines 10-15: Write a short description of what this event handler does.
○ Will make the program pick a random word out of a certain amount and display one
word on the random top and random one on the bottom

4. Line 18: What is the conditional statement ​topsIndex < topsList.length - 1​ checking? What would
break if it was instead ​topsIndex < topsList.length​?
○ It wouldn't have the -1 messing up the code

5. Lines 38-43: Find all the places that the ​updateScreen​ function is called. What changes about
the way the app runs if any of these calls were removed?
○ It is used once the button is pushed and changes most of the screen

____________________________________________________________
If you selected ​Band Namer on Level 4​ answer these questions

1. Lines 1-2: Why are there two lists in this app instead of 1?

2. Lines 4-5: Why is "Sideways Monkeys" always the first band name shown?
3. Line 10: What would break if this line read ​randomNumber(0,nounList.length)​ instead of
randomNumber(0,nounList.length-1)​?

4. Lines 17-20: Write a short description of what each line in this function is doing.

____________________________________________________________
Level 5​ - watch the video

____________________________________________________________
Level 6​ answer the following questions about the Pair Maker app

1. Line 6: What does ​.join()​ do? Why is it necessary for this app to run?
a. Combines to names together

2. Line 7: This line of code references an ​"options"​ property of a dropdown. Write a short
description of what this line of code does.
a. It makes the dropdown menu with the peoples names on it

3. Lines 18-19: This line of code references an ​"index"​ property of a dropdown. Go look at
what that property does in Design Mode. Then describe how these lines of code work
together to remove a user from the list of partners?
a. Locks in the right choices for the pair equation

4. Line 24: Why does this conditional read ​peopleList.length >= 2​? What would break if it read
peopleList.length >= 1​ instead?
a. You would only get half the match and not the whole thing

5. Line 26 - 27: What would happen if you switched the order of these two lines of code?
a. It would mess up the order

You might also like