CS 100 HW 2: Get Coding on Code.org
- Due: 11:59pm Friday 9/18/2014
- Submit to Blackboard by deadline
CHANGELOG: Empty
Table of Contents
1 Instructions
- Complete the problems in each section below which is labelled Problem
- This is an individual assignment: you must do your own work and may not share or compare answers with other students. If you are struggling, ask questions on Piazza, seek help from the TA or professor, and review the class notes and tutorial links provided.
- Do your work in an acceptable electronic format which are
limited to the following
- A Microsoft Word Document (.doc or .docx extension)
- A PDF (portable document format, .pdf)
You may work in other programs (Apple Words, Google Docs, etc.) but make sure you can export/"save as" your work to an acceptable format before submitting it.
- Submit your work to our Blackboard site.
- Log into Blackboard
- Click on CS 100->HW Assignments->HW 2
- Press the button marked "Attach File: Browse My Computer"
- Select your file
- Click submit on Blackboard
2 Problem 1: Code.org Exercises
There are 98 coding exercises in Code.org's "Accelerated Intro to CS" course. Do them.
Make sure to sign up for code.org's class using the following link so that your progress is recorded for our class: http://learn.code.org/join/QMMGKP
Stage | Name | Exercises |
---|---|---|
Stage 2 | The Maze | 20 |
Stage 5 | The Artist | 10 |
Stage 7 | The Artist 2 | 11 |
Stage 9 | The Farmer | 11 |
Stage 11 | The Artist 3 | 11 |
Stage 13 | The Farmer 2 | 10 |
Stage 15 | The Artist 4 | 10 |
Stage 17 | The Farmer 3 | 9 |
Stage 19 | The Artist 5 | 6 |
Total | 98 |
- You can skip all the "Unplugged Activities"
- Track your progress by clicking your name in the upper right corner
and selecting "Code Studio" then "View Course" which should show a
screen like the bottom picture.
- During the "Artist" exercises, make sure to save a few pictures
that you create and find interesting. These should show up in your
"Gallery" which is at the bottom of the "Code Studio" Page.
What to include in your HW Writeup
- Include a section called Problem 1 where you state how many exercises on code.org you finished
- Example: Problem 1: I finished 94 of the 98 exercises
- Your progress will be checked via the web site so make sure you count your exercises correctly
3 Problem 2: The Elements of Programming
After working through the code.org exercises, you should now have a reasonable idea of the common elements that recur in programming. One can broadly group these elements by the color of the blocks that show up in the exercises. The blocks are also categorized in the later exercises as there end up being quite a few blocks that are useful. Describe the nature of each of the categories below. Pictures of the blocks are given for reference.
For each Category, describe the nature of the blocks in the category in 3-4 sentences. What are they used for? How are the blocks in the same category related?
Actions/Primitives
Loops/Iteration
Conditionals/Logic
Variables
What to put in your HW Write-up:
- Descriptions of each of the 4 elements of programming above
4 Problem 3: Recursion
The final exercise of Code.org (Stage 19 Exercise 6) deals with a novel concept: recursion. Computery science-types and the mathematically inclined love recursion for its ability to say very little and accomplish much.
Have a look at the following simplified version of the final exercise.
http://learn.code.org/sh/34041789
Press the "How It Works" button in order to show the blocks and allow you to play with the code.
The main feature of this demo is the draw a tree
function but its
definition has been altered and simplified from the original exercise.
Run the code, examine what it draws, and play around with the
structure and parameters.
Answer the following questions (2-3 sentences each).
- What kind of tree does
draw a tree
create on running? How many branches does it have? Does the parameterbranches
matter in this version? - What does the parameter
depth
control? How does the shape and size of the tree change asdepth
is changed? What does the tree look like for small values of depth like 1, 2, and 3 versus 6, 7, 8? - Why is
draw a tree
a weird looking function? What distinguishes it from most of the other functions that you worked with in the code.org exercises such asdraw circle
in Stage 19 Exercise 4 and 5?
What to put in your HW write-up:
- Answers to the 3 questions about the recursive tree code above