MCQ for Python lesson 1

Mar 11, 2015 • Derek Howard

Multiple choice questions are for Python lesson 1

##MCQ 1:

What will be returned when we take the following slice of the string:

string='Software Carpentry'
string[4:]
  1. 'Soft'
  2. 'ware Carpentry'
  3. 'w'
  4. 't'

##MCQ 2: What will be the output of the following code:

array=[[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
print(array[2][1])
  1. 8
  2. 6
  3. 4
  4. 2

##Notes on distractors:

The focus is on retrieving correct value from the array.

  1. Answer
  2. If the student reverses the indices they could get this value
  3. If the student forgot that indexing starts at 0 they could get this value
  4. If the student reversed the indices and forgot that indexing starts at 0, they could get this value