ICS 31 -- Winter 2013 -- Quiz 1

  • 1. Each of the following statements claims to be a policy, procedure, good advice, or other characteristic of ICS 31, but each is inaccurate, misguided, or wrongheaded in some way.  Please change the statement (as little as necessary) to make it an accurate statement on the same topic.


    1. We expect students in ICS 31 to have at least two years' experience writing software.

      Answer Feedback:
      No previous programming experience is expected of ICS 31 students.

    2. The best and fastest way to get answers to questions about the course material is to send Email to the instructor and TAs.

      Answer Feedback:
      Posting on Piazza.com is best for questions about course material. Email is better for private correspondence.

    3. In pair programming, two programmers split up the work so they can finish twice as fast.

      Answer Feedback:
      In pair programming, two programmers work together, one "driving" at the keyboard and the other "navigating". (In fact, studies show that this arrangement gets the work done faster.) Splitting up the work is not pair programming and is not how labs in ICS 31 should be done.

    4. In pair programming, it's best to find the most experienced partner you can, so your partner can do all the hard parts.

      Answer Feedback:
      If you let your partner carry the weight, you won't learn the material; it's like asking someone else to exercise for you. Both partners need to discuss and understand the solutions. That can happen when one partner is much more experienced than the other, but it's more of a give-and-take if the partners are more evenly matched.

    5. This is college; attending class and lab are optional, so missing them has no bad consequences.

      Answer Feedback:
      Lab is where you do your lab work with your partner each week, and where the TA and lab tutors are available to give you help. Lecture is where topics are introduced and explained, and where broader topics are covered; even with the UCI Replay recordings, you miss everything that's not on the computer screen or the audio.
  • 2. Reflecting our discussion in class last week:


    1. List three application areas of information technology.  That is, list three specific tasks or activity categories that we use IT for.

      Answer Feedback:
      There are many, many possible answers here. In fact, it's hard to think of an area that isn't affected by IT. Activities mentioned in class include interactive entertainment/games, music, text production and publishing, graphic design, independent education.

    2. List three characteristics of computers that make them particularly good at the tasks listed above.

      Answer Feedback:
      Again, many possible answers. For example:

      • They can do calculations very quickly

      • They can store large amounts of information in a small physical space (and can search and retrieve it quickly)

      • They are consistent and accurate at repetitive tasks

      • Today's computers are small and portable

      • They provide a flexible, general platform for building models of the real world

  • 3. What is the value of each of the Python expressions below? Use these values where appropriate:

    r = 17
    s = 'download'
    1. 10 * r
      Answer Feedback:
      170
    2. (20 * 4) / (r - 7)
      Answer Feedback:
      8.0
      For now, an answer of 8 is okay. But because there's a division operator (/) in this expression, the type of the result is float, and float-type numbers are normally displayed with a decimal point.
    3. 'pine' + 'cone'
      Answer Feedback:
      'pinecone'

      It's not correct to have a blank in the middle.
      (For quiz purposes it's okay to omit the quotation
      marks at the ends of a string in this context, where
      you're just giving the value of a string---but
      correct quotes are essential in any Python
      code you write.)
    4. len(s)
      Answer Feedback:
      8
    5. s[2] # Remember zero-based indexing

      Answer Feedback:
      'w'

      You should also be able to evaluate expressions like
      s[1:4], s[1:], s[-4], and s[-4:]
    6. r == (34 / 2)
      Answer Feedback:
      True.
      (For quiz purposes it's okay not to
      capitalize True, but in actual code
      it matters.)

      Remember that == is the boolean operator that tests for equality. The assignment operator is a single equal sign; it means "Make the name on the left equal to the value on the right."
  • 4. For each of these sequences of statements, what does Python print?

    1. a = 5 
      b = a * 10
      print(a, b)
      Answer Feedback:
      5 50

      (To be accurate, both numbers appear on the same line, separated
      by one space.)
    2. c = 'Hello'
      print(c)
      c = c + ' again'
      print(c)
      Answer Feedback:
      Hello
      Hello again

      (Two print statements, two lines of output.
      The print function doesn't surround its result with quotation marks.
      Note the space before 'again'.)
    3. make = 'Toyota'
      model = 'Camry'
      year = 1998
      print('She drives a', year, model)
      Answer Feedback:
      She drives a 1998 Camry


      This early in the quarter, we might not be sticklers for the precise spacing, but eventually it will matter. The print function automatically adds one space between the items it prints out; this is reflected above.