Lab 5

Logistics

  • Due: on Thursday, September 29th anywhere on earth (6am Friday). (Penalties from the syllabus apply if you turn it in any later.)
  • Submission instructions: submit any text file (Word document, .txt, pdf, etc) to the Lab 5 dropbox on D2L.

Learning outcomes

  • Review for the quiz

Assignment

Write one multiple choice question about any topic we have covered. There must be at least two choices, but there can be more than that if you prefer. You can do true or false questions, true multiple choice (only one is correct), or multi-select (more than one may be correct). Indicate what the correct answer is, and briefly explain why it is correct. Finally, indicate which lecture topic or day your question is related to. If it’s related to more than one, just try to say at least one.

Examples

What does the final modifier do?
(a) Makes a variable visible only to the class it is defined in
(b) Makes it so a variable can never be changed once it is initialized
(c) Makes it so a methood can be called using the class name, rather than an instance of the class
(d) Ends the program

The correct answer is (b), since that's precisely what the final modifier does.

This question is related to the topic of modifiers from lecture 5.

----

Which of the following declares and initializes an array of ints? (There may be
more than one correct answer.)
(a) int[] nums = {1, 2, 3, 4, 5};
(b) int[] nums = new int[5];
(c) int[] nums;
(d) nums = [1, 2, 3, 4, 5];
(e) double[] nums = {1, 2, 3, 4, 5};

(a) and (b) are correct. (c) declares but doesn't initialize the array. (d)
won't compile (though it would run in Python!). (e) declares and initializes an array of doubles, not ints.

This question is related to Lecture 3.

Grading - 10 points

  • 4 points - you provide a multiple choice question with at least two answers related to the material covered up to Monday, September 26th.
  • 4 points - you provide a correct answer and a brief explanation of why it is the correct answer.
  • 2 points - you provide at least one lecture that the question is related to.

Grading turnaround

This lab will be graded with scores in Brightspace before Tuesday, October 4th.