Week 2 Checks for Understanding

With your group, answer each question below. Spend some time discussing each question without using any resources; use your own recall of the topics covered this week. If, after you have discussed without resources, your group needs assistance, post on the support thread in Slack and an instructor will come help!

  1. Define the following terms:
    • Loop
    • Iteration
    • Infinite Loop
  2. Annotate the code below. What is happening on each line?
     string userInput = "";
     int index = 0;
    
     while (userInput != "stop" && index < 101)
     {
         Console.WriteLine($"Current Count is: {index}");
         index++;
         Console.WriteLine("Enter to continue counting, 'stop' to exit");
         userInput = Console.Readline();
     }
    
     if (index > 100)
     {
         Console.WriteLine("I don't know any more numbers");
     }
     else
     {
         Console.WriteLine($"Thanks for letting me count to {index}");
     }
    
  3. How many code blocks are in the example above?

  4. Imagine you are explaining an Array or List to one of your non-developer friends; write out an explanation of what index is - how does it apply to lists/arrays, and why is it useful?

  5. How are Arrays and Lists similar? How are they different?

  6. Create an Array that will hold your top 8 best friends.

  7. Create a List that will hold your favorite movies.

  8. For the two collections above, why is it appropriate for best friends to be an Array, and for favorite movies to be a List?

  9. Create a Dictionary that organizes an artist’s discography - you could use the data below as a starting point:
Jimmy Buffett: abbreviated discography

Son of a Son of a Sailor:
    - Cheeseburger in Paradise
    - Manana
    - Cowboy in the Jungle
Christmas Island:
    - Run Rudolph Run
    - Mele Kalikimaka
    - Ho Ho Ho and a Bottle of Rum
Banana Wind:
    - Only Time Will Tell
    - School Boy Heart
    - Desdamona's Building a Rocket Ship

Fork this REPL

  1. Annotate the code. What is happening on each line?
  2. How many code blocks are in the example above?

Fork this other REPL to complete the following task.

  • Write a for loop that will ask a user for 5 items to put on a wish list. Store these items in a string called wishList.

Lesson Search Results

Showing top 10 results