Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ryanmillergm/f5a19bb7d50b2c4060c5a615e44a2247 to your computer and use it in GitHub Desktop.

Select an option

Save ryanmillergm/f5a19bb7d50b2c4060c5a615e44a2247 to your computer and use it in GitHub Desktop.
Mod 0 Session 2 Practice Tasks

Session 2 Practice Tasks

The assignments listed here should take you approximately 2 hours.

To start this assignment, click the button in the upper right-hand corner that says Fork. This is now your copy of the document. Click the Edit button when you're ready to start adding your answers. To save your work, click the green button in the bottom right-hand corner. You can always come back and re-edit your gist.

1. Documentation and Googling (75 min)

Documentation of a langauge, framework, or tool is the information that describes its functionality. For this part of the practice tasks, you're going to practice digging into documentation and other reference material.

NOTE: The linked documentation for each question below is a good starting place, but you should also be practicing your Googling skills and sifting through the results to find relevant and helpful sites.

  • In your own words, what does the Ruby array drop method do? As you're explaining, be sure to provide an example.

Your answer: It removes elements in an array that return nil or false and returns the array with the remaining elements.

What did you Google to help you with this task, and how did you pick your results?

Google helped me quickly find the drop method explanation. I used the Ruby documentation site because it is the most legit.

  • In your own words, what does the Ruby array push method do? As you're explaining, be sure to provide an example.

Your answer: It adds what ever you want to the end of an array.

What did you Google to help you with this task, and how did you pick your results? It confirmed what I was already pretty sure it did.

  • In your own words, what does the Ruby string split method do? As you're explaining, be sure to provide an example.

Your answer: Splits a string into an array in whatever specified manner.

What did you Google to help you with this task, and how did you pick your results? I stuck with the one site with all the answers.

  • In your own words, what does the JavaScript array slice method do? As you're explaining, be sure to provide an example.

Your answer: It cuts out which ever specified elements and puts them in a new array.

What did you Google to help you with this task, and how did you pick your results? I compared multiple websites answers to come to my conclusion.

  • In your own words, what does the JavaScript object values method do? As you're explaining, be sure to provide an example.

Your answer: An object in javascript is keys and values. The values method returns an array with just the values.

What did you Google to help you with this task, and how did you pick your results? Helped me clarify the meaning since the first answer was somewhat confusing.

2. Data Types (15 min)

Imagine that you're taking your favorite board game and turning it into a computer-based game.

  • Name of board game: Chess

  • Use the space below to categorize game data into each of the following data types. You should have a minimum of two pieces of data for each category.

  1. String data: "Pawn", "Queen", "King", "Rook", "Knight", "Bishop"
  2. Integer and/or float data:
  3. Boolean data: Can object move to such space? Can object kill such object?
  4. Array data: Board. Spaces on board.
  5. Hash or Object data: Pawn can much these ways. Queen can much these ways. etc...

3. Iteration (30 min)

  • On a blank sheet of paper, create a diagram that shows how you understand iteration working. Be detailed and get creative! This should not be the simple table that we used during the lesson. When you're done, take a photo of your diagram and send it to Rachel and Tim on Slack. (If you're feeling extra fancy, feel free to create your diagram using software instead of pencil and paper)

  • Create a list below of three real-life situations where iteration is used. For each situation, explain why it would be an example of iteration.

  • Doing inventory for a business. Every week you are updating your inventory of products.

  • Creating a recipe. You may change the amounts and ingredients many times before coming to a final recipe.

  • Grades. Grades are continually changed and updated throughout a course.

  • Create a list below of three programming situations where iteration would be used. For each situation, explain why it would be an example of iteration.

  • A game that is constantly updating light. It would have to constantly be updating due to shadows and brightness of day.

  • A website with a live clock on it. While the website page is being viewed the time is being updated.

  • A production assembly line program. Telling machines what to do to build something and repeat.

@timomitchel
Copy link

Ryan, nice job with this task. I encourage you to provide examples whenever possible, as this will help you gain a mastery of these concepts. Also remember for iteration, we always start with a collection, so for your inventory example, the inventory is the collection, and for each item you will update it's status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment