MC1-Homework-3

From Quantitative Analysis Software Courses
Revision as of 12:43, 21 January 2016 by Tucker (talk | contribs) (→‎Example)
Jump to navigation Jump to search

Overview

The purpose of this assignment is to help you study for the midterm by involving you in the creation of the midterm. The TAs and the instructors will select the best 70 or so questions for the actual exam. If your question is selected you will get full credit.

Task

You are to create a multiple choice question regarding Python/Numpy/Pandas for the midterm. You should provide:

  • The question itself.
  • 4 possible answers labeled a) through d)
  • Short, complete, real Python transcript that "proves" the correct answer.

Your 4 answers should include one unambiguously correct response and at least one other attractive answer that might be selected if the student is not well informed. The intent is that these questions should be easy if the student has been doing his own programming and hard if they have not. I do NOT want these to be trick questions, or questions that require encyclopedic knowledge.

Submit your response as text only question.txt. We do not want PDFs, image files or word documents.

Two types of questions

We're looking for two primary forms of questions:

  • Type 1: What is the output of this python code? In this example, we provide Python code, and then several potential example answers.
  • Type 2: Fill the blank in above to cause this Python code to give the following output.

What to turn in

  • Submit your question as a single file question.txt via t-square. It is essential that you use that name exactly.
  • Do not submit other files.
  • Don not submit word documents, image files, zip files or PDFs.
  • Make sure your file is named correctly.
  • Under no circumstance should you submit a word document.

Rubric

The question will be scored from 0 to 100%. 10% will be deducted for each criteria not met. For the question:

  • Is the question unambiguous? There should be only one possible interpretation of the meaning of the question.
  • Are there multiple plausible answers? If one made a wrong assumption or math mistake they might choose the alternative, wrong answer.
  • There should be only one correct answer.
  • The question should not be too hard. i.e., it should not require memorization of Pandas API calls, or complex calculations.
  • The question should not be too easy. i.e., it should not be trivial.

For the answer part:

  • Python questions must be validated with transcripts of actual python code and output. The example code should be completely self contained, including import statements, etc.

Example

How should section A be filled in to complete code that will cause the following output:

import numpy as np
j = np.random.random([2,2])
print j
print _A_ 

Output:

[[ 0.70774499  0.99293455]
 [ 0.0762406   0.81082289]]
[[  1.          13.02369813]
 [  0.10772326  10.635054  ]]

Select one answer:

  • a) j / j[0,:]
  • b) j / j[:,0]
  • c) j * j[:,1]
  • d) j / j[:,1]

Correct answer: b)

Python transcript:

>>> import numpy as np
>>> j = np.random.random([2,2])
>>> print j
[[ 0.70774499  0.99293455]
 [ 0.0762406   0.81082289]]
>>> print j/j[:,0]
[[  1.          13.02369813]
 [  0.10772326  10.635054  ]]