Weird Cases in Lists


This quiz is not graded. By this point, we do not assume you know the answers to all of these questions, and we encourage you to make a best guess for each question. We also want to reinforce that the answers to these questions will be important later on, but that you can figure them out whenever you need to!

The questions in this quiz are essentially “what does this do?” questions. When dealing with these questions, you must realize that people designed every programming language. So, people weighed pros and cons and made a decision about what the language should do in each situation (its specifications). You might disagree with them about what should happen, but it is important to realize that you can always test code to figure out what it does.

The following questions test boundary cases, where what the code should do is not intuitive.

1) Assuming that you only have five elements in your players list, what would happen if you ran the script below?

  1. “thing” will be added to the end of the list
  2. “thing” will be added to the beginning of the list
  3. The list will remain unchanged
  4. Blank entries will be added to the list so that the new element can be inserted at the index specified

2) Are the words in a list case-sensitive? In other words, is “Thing” different from “thing"?

  1. Yes
  2. No

3) What happens when you run the script below with a list that has no elements?

  1. The block will report a blank.
  2. The block will turn red and there will be an error.
  3. The block will report the item that was most recently at the specified index.
  4. The block will not run.

4) What gets added to players when you run the following script?