Directions
All lab check-off deadlines are at 11:59PM.
(However, you need to get checked off by a TA or lab assistant, so you last chance to get checked off is during lab or office hours.)
To get checked off, you should prepare answers to all of these questions for each lab, though you will only be asked about the 2 or 3 questions which are marked as required. You shouldn’t feel compelled to memorize every single detail of lab. The goal here to make sure you’re on track with CS10 and you should be comfortable with the higher level concepts for each question. For each lab the first questions are the biggest ideas, and the later questions are for your own benefit and review.
Lab 1: Welcome to snap
No questions for this lab!
Lab 2: Build Your Own Blocks
Due: 02/04/15
- Why should we make our own blocks?
- How do you make a block?
- How many different types of blocks are in snap? What do they do?
- Show us the
Draw a Star
exercise.
- Show us the
Draw Polygon
block.
- Show us the
Draw Flower
block.
- Make the bug dance!
- Name 3 different ways you can make a block repeat.
- What does the pick random block do? Give a scenario where this functionality could be useful.
Lab 3: Conditionals
Due: 02/06/15
- Why are booleans important?
- What are some of the booleans we have access to in snap and what do they do?
- What is the difference between
if
and if-else
blocks?
- What is the difference between reporter and predicate blocks?
- What is a script variable useful for? How do we initiate a script variable?
- Show us the code for the
letter grade _
block.
- Correctly answer the questions on the “Self-test: Complex Booleans” page and show us.
- Show us the code for the
is _ between _ and _ ?
block.
- For the Leap Year example, explain which code was easiest to read and which code was easiest to debug.
Lab 4: Functions
Due: 02/11/15
- What was Mark’s problem with his
max
block?
- Name a few of the input types. Why is it important that we specify input types?
- Please show me your “sum of 2 smallest numbers” block or the “are any equal” block, and explain how you composed functions to write these blocks.
- What is a script variable useful for? How do we initiate a script variable?
- Please show some of your solutions to the buggy “sum the numbers between block.” Do they work now? What did you change?
- Please show your simplified tic-tac-toe board. Why did you organize it the way you did?
- Can i see your
valid-date
block? How is what you did here similar to simplifying the tic-tac-toe board?
- Why is the check block useful? And how does it work? Demonstrate please.
- How are global variables different from script variables?
Lab 5: Lists
Due: 02/13/15
- What are lists? How are they represented in Snap? What are some operations you can perform on lists?
- How are lists different from variables? How are they similar? How do you create a temporary list for use in a block definition?
- Which blocks allow you to use a function on an entire list “all at once”? What are the different effects that they have? What are their domains and ranges?
- Demonstrate your
Acronym
(Initialism) block.
- Demonstrate your
Exaggerate
block.
- What is the difference between the
for
and for each
blocks?
- Lets look at
swap
. Why do we need a temp variable?
- Why might global variable manipulation be useful in some situations? what drawbacks are there?
Lab 6: Algorithms
Due: 02/18/15
- What is an algorithm? Can you give an example of an algorithm that you use in your daily life? What about from an earlier lab?
- Show me your
find number in an unsorted list
block. Describe the algorithm that you used to solve this problem.
- Show me your
find number in a sorted list
block. What algorithm are you using in this block and how does it work?
- Why was the binary search technique so much faster than trying to find a number in an unsorted list? Is it actually faster when considering the time needed to sort the list initially?
- If the number of inputs, N, doubles, how would that change the Worst Case Running Time for
find number in unsorted list
?
- If the number of inputs, N, doubles, how would that change the Worst Case for
find number in sorted list
?
- How can we objectively measure which algorithm, sorted or unsorted, is faster. What kind of extra work is required for the sorted algorithm? Are there cases where unsorted might be faster?
- What is memoization? If you were able to implement it in the
find number in sorted list (memoized)
block, what makes memoization faster?
Lab 7: Algorithmic Complexity
Due: 02/20/15
- In your experimental
Number-guessing
game, which algorithm did you find to be faster? Why? What type of search is Higher/Lower
representing?
- What happened with the time it took for your computer to counter up the numbers between 1 and x when you started doubling the numbers? Tripling the numbers? What do you think would happen with the time I multiplied your top number by 8?
- Please show me your Non-Gauss and Gauss
Add all numbers in
. Which was faster? Why?
- Please show me your
Are the numbers of (LIST) distinct?
block. What is the difference between “Worst-Case” and “Best Case” in terms of Runtime?
- Of all the runtimes you have discovered thus far, can you rank them from “fastest” to “slowest”? Why is runtime important for the programs that we create?`
Lab 8: Finch Robots [Extra Credit Checkoff]
Due: 02/20/15 (not the usual one-week delay)
- Due to the hardware requirements of this lab, it will be worth extra credit and can only be completed during a lab section between 02/18 and 02/20. Make sure to attend one of those labs and take part in the section competition in order to receive extra credit.
Lab 9: Concurrency
Due: 03/04/15
- How can you make parallel programs in snap?
- Why does adding more people in the card sorting example or more threads in a program sometimes slow the process down?
- When you run parallel code, are the chunks of code really executing at the exact same time?
- What are some issues that can occur in parallel programming?
- What is the difference between determinism and nondeterminism?
- In the
What are the possible values?
exercise, what were the possibles values of finish
when you run the code nondeterministically?
Lab 10: Recursion With Trees and Fractals
Due: 03/06/15
- What is recursion? Why is it so powerful?
- What do you think infinite recursion is? How do you prevent infinite recursion from happening?
- What are some real-life examples of recursion?
- What is the difference between the base case and the recursive case?
- Please show me your
crazy-tree
block.
- Please show me your
snowflake
or c-curve
block.
Lab 11: Recursive Reporters
Due: 03/11/15
- Explain how the
plurals(words)
block works.
- Show me your recursive
exaggerate
block. Do you like the iterative or recursive version better? (1 pt. for correct opinion)
- Convince me that the recursive
pascal(row, column)
works (defend the base and recursive cases).
- Why does
odd numbered items
need two base cases?
- Show me your finished
merge
block.
- Explain how the
subsets
block works.
Lab 12: Tic-Tac-Toe
Due: 03/18/15
- How are lists used to implement the tic-tac-toe board? Why does this strategy work? Would this strategy work even with a larger board?
- Show your
appearances
or substitute triple
block, and explain your implementation (You could be asked either, so be prepared for both!).
- What did you find to be the most pivotal block in your creation of the game? Show the code for this block, explain your implementation of it works, and explain how the game would have not worked without it.
- The lab mentioned a few core rules that are part of everyone’s tic-tac-toe strategy (in the Program Structure and Strategy section), and thus encouraged them as part of your computer program. It went on to say “Humans don’t always think alike about the in-between rules; we’ll make suggestions later, after you finish the minimal assignment.”
Why do humans not always think alike about the “in-between rules”? Can you give an example of how two people might think differently about an “in-between rule” and explain the difficulties in implementing that in a program?
- Show your
winning-square
or full ttt
block (Again, you could be asked either, so be ready for both!).
- When was it best to report positions for some of the tic-tac-toe blocks, and when was it more ideal to report actual letters (‘X’ or ‘O’)? Relate your explanations back to domain and range.
Lab 13: The Internet
Due: 04/08/15
Required Questions
- Of the shell commands traceroute, whois, and telnet, explain and demonstrate one of them. Why is the information they return useful?
- What is the difference between latency and throughput? What shell command can you use to measure latency?
- What is an information footprint, and what steps can you take to lessen your footprint in the future?
Self-Check Questions
- Pick a website of your choosing and get the page source. What language is the page source written in?
- How do you start a shell and what is the shell useful for?
- What is a Domain name?
- Try pinging a website’s url. What does ping measure?
Lab 14: Lambdas and HOFs
Due: 04/10/15
Required Questions
- How can we use functions as data in Snap? What do the “call” and “run” blocks do, and what’s the difference between them?
- Demonstrate your
list all factorions between __ and __
block.
- Demonstrate your
is __ pandigital?
block.
Self-Check Questions
- How does the
compose
block work?
Lab 15: Besides Blocks: Welcome to Python!
Due: 04/15/15
Required Questions
- What is the difference between the syntax of one equals sign (=) vs. a double equals sign (==) in Python?
- What is 0-indexing, and why is it relevant to string manipulation in Python? Show how to create a substring from a string.
- Run the “python virus.py run_tests” command to check that all the exercises work.
Self-Check Questions
- Show how to open the Python interpreter and run a script.
- What is a directory?
- How do you make a directory, enter a directory, and check what is inside your current directory?
Lab 16: Besides Blocks: Data Structures in Python
Due: 04/22/15
Required Questions
- Show that your PythonLab2.py file passes the tests for all 6 exercises.
- What are the similarities and differences between lists and dictionaries? What are ‘keys’ and ‘values’ and how do they compare to numerical indices in lists?
- How can you easily iterate through the items of a list? What about a dictionary?
Self-Check Questions
- What similarities do you notice between Snap! and Python? Differences?
- What is an iterable and iterator?
- What do Higher Order Functions look like in Python?
Lab 17: Besides Blocks: Data in Python
Due: 04/24/15
Required Questions
- What is a corpus and how can it be useful? What is a good place to start analyzing a large set of data like a corpus?
- What techniques are there to clean data and why is cleaning data important? Why is it expensive?