Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cgeglio/d778e3a1731799ef75c44b484c8c7193 to your computer and use it in GitHub Desktop.
Save cgeglio/d778e3a1731799ef75c44b484c8c7193 to your computer and use it in GitHub Desktop.
Mod 0 Session 1 Practice Tasks

Session 1 Practice Tasks

The assignments listed here should take you approximately 40 minutes.

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 (20 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 string split method do? As you're explaining, be sure to provide an example. Your answer: The Ruby string [split] method breaks up strings into an array containing substrings based on how you chose to split up the original string. For example, you could split up the string "hello world" into the substrings ["hello", "world"] or ["h", "e", "l", "l", "o", "w", "o", "r", "l", "d"]

  • What did you Google to help you with this task, and how did you pick your results? I googled "delimiter programming" and "ruby split method." I clicked on a few of the top results for each search and they all yielded similar information, so I figured I was on the right track.

  • In your own words, what does the JavaScript array slice method do? As you're explaining, be sure to provide an example. Your answer: The JavaScript array [slice] method allows you to pull certain parts of an array into a new array. The numbers you put in [] represent the beginning of your selection and where you want your selection to end.

var fruits = ['apple', 'banana', 'orange', 'pineapple'];

console.log(fruits.slice(1)); // expected output: Array ["banana", "orange", "pineapple"]

console.log(fruits.slice(1, 3)); // expected output: Array ["banana", "orange"]

  • What did you Google to help you with this task, and how did you pick your results? I googled "javascript slice array." I avoided the top result from w3schools because I remembered from class that this source is not always great. I clicked on a different result from stack overflow because I know that is a trusted source. That result wasn't super relevant so I went back and looked at posts on tutorialspoint.com and freecodecamp.org that had relevant information.

2. Data Types (20 min)

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

  • Name of board game: Scrabble

  • 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. Try practicing variable assignment in this exercise.

  1. String data: "scrabble", "player 1", "player 2" var playerOne = "Jack"; var playerTwo = "Jill";
  2. Integer and/or float data: number of tiles remaining (int), player 1's score (int), player 2's score (int)
  3. Boolean data: does each player have 7 tiles?, was a letter tile placed on a special score square (ie triple word score, triple letter score)? did the player use all 7 of their tiles (50 extra points)?
  4. Array data: list of letter tiles available ["a1","a2","b1","c1"...], list of letters that have already been used ["d1","e1","e2","f1"], names of players 1 and 2 ["jack","jill"],
  5. Hash or Object data: player 1 (key) and current tiles on holder (value) {"jill":5, "jack":7}, specific letter (key) and the number of tiles of that particular letter still available (value) {"a":3, "z":0}

3. Questions/Comments/Confusions

If you have any questions, comments, or confusions from the any of the readings that you would like an instructor to address, list them below:

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