lms.model.testdata.quizzes

  1import typing
  2
  3import quizcomp.question.base
  4
  5import lms.model.quizzes
  6
  7# {course_name: {name: quiz, ...}, ...}
  8COURSE_QUIZZES: typing.Dict[str, typing.Dict[str, lms.model.quizzes.Quiz]] = {}
  9
 10# {quiz_name: {name: group, ...}, ...}
 11QUIZ_GROUPS: typing.Dict[str, typing.Dict[str, lms.model.quizzes.QuestionGroup]] = {}
 12
 13# {quiz_name: [group, ...], ...}
 14ORDERED_QUIZ_GROUPS: typing.Dict[str, typing.List[lms.model.quizzes.QuestionGroup]] = {}
 15
 16# {quiz_name: {name: question, ...}, ...}
 17QUIZ_QUESTIONS: typing.Dict[str, typing.Dict[str, lms.model.quizzes.Question]] = {}
 18
 19# {quiz_name: [question, ...], ...}
 20ORDERED_QUIZ_QUESTIONS: typing.Dict[str, typing.List[lms.model.quizzes.Question]] = {}
 21
 22# pylint: disable=line-too-long
 23COURSE_QUIZZES['Course 101'] = {
 24    'Regular Expressions': lms.model.quizzes.Quiz(
 25        id = '110000200',
 26        name = 'Regular Expressions',
 27        points_possible = 0.0,
 28        description = "This quiz is open note, open book, and open world. Assume all regular expressions are done in Python using the `re` standard library. Good luck!\n\n  \n\n\n* * *\n\nVersion: UNKNOWN",
 29    ),
 30}
 31
 32QUIZ_GROUPS['Regular Expressions'] = {
 33    "Ice Breaker": lms.model.quizzes.QuestionGroup(
 34        id = "110000201",
 35        name = "Ice Breaker",
 36        pick_count = 1,
 37        points = 5.0,
 38    ),
 39    "Regular Expression in Programming Languages": lms.model.quizzes.QuestionGroup(
 40        id = "110000202",
 41        name = "Regular Expression in Programming Languages",
 42        pick_count = 1,
 43        points = 5.0,
 44    ),
 45    "Regular Expression Vocabulary": lms.model.quizzes.QuestionGroup(
 46        id = "110000203",
 47        name = "Regular Expression Vocabulary",
 48        pick_count = 1,
 49        points = 20.0,
 50    ),
 51    "Basic Regular Expressions": lms.model.quizzes.QuestionGroup(
 52        id = "110000204",
 53        name = "Basic Regular Expressions",
 54        pick_count = 1,
 55        points = 5.0,
 56    ),
 57    "Passage": lms.model.quizzes.QuestionGroup(
 58        id = "110000205",
 59        name = "Passage",
 60        pick_count = 1,
 61        points = 0.0,
 62    ),
 63    "Passage Search": lms.model.quizzes.QuestionGroup(
 64        id = "110000206",
 65        name = "Passage Search",
 66        pick_count = 1,
 67        points = 10.0,
 68    ),
 69    "Quantifiers": lms.model.quizzes.QuestionGroup(
 70        id = "110000207",
 71        name = "Quantifiers",
 72        pick_count = 1,
 73        points = 5.0,
 74    ),
 75    "General Quantification": lms.model.quizzes.QuestionGroup(
 76        id = "110000208",
 77        name = "General Quantification",
 78        pick_count = 1,
 79        points = 5.0,
 80    ),
 81    "Backreference Matching": lms.model.quizzes.QuestionGroup(
 82        id = "110000209",
 83        name = "Backreference Matching",
 84        pick_count = 1,
 85        points = 10.0,
 86    ),
 87    "Regex Golf": lms.model.quizzes.QuestionGroup(
 88        id = "110000210",
 89        name = "Regex Golf",
 90        pick_count = 1,
 91        points = 15.0,
 92    ),
 93    "Write a Function": lms.model.quizzes.QuestionGroup(
 94        id = "110000211",
 95        name = "Write a Function",
 96        pick_count = 1,
 97        points = 20.0,
 98    ),
 99}
100
101ORDERED_QUIZ_GROUPS['Regular Expressions'] = [
102    QUIZ_GROUPS['Regular Expressions']['Ice Breaker'],
103    QUIZ_GROUPS['Regular Expressions']['Regular Expression in Programming Languages'],
104    QUIZ_GROUPS['Regular Expressions']['Regular Expression Vocabulary'],
105    QUIZ_GROUPS['Regular Expressions']['Basic Regular Expressions'],
106    QUIZ_GROUPS['Regular Expressions']['Passage'],
107    QUIZ_GROUPS['Regular Expressions']['Passage Search'],
108    QUIZ_GROUPS['Regular Expressions']['Quantifiers'],
109    QUIZ_GROUPS['Regular Expressions']['General Quantification'],
110    QUIZ_GROUPS['Regular Expressions']['Backreference Matching'],
111    QUIZ_GROUPS['Regular Expressions']['Regex Golf'],
112    QUIZ_GROUPS['Regular Expressions']['Write a Function'],
113]
114
115QUIZ_QUESTIONS['Regular Expressions'] = {
116    'Ice Breaker': lms.model.quizzes.Question(
117        id = '110000201',
118        question_type = quizcomp.question.base.QuestionType.ESSAY,
119        name = 'Ice Breaker',
120        points = 1.0,
121        prompt = "Taking inspiration from the XKCD comic below, how would you save the day using regular expressions?\n\n![XKCD Comic 208](http://127.0.0.1:3000/courses/110000000/files/1/preview)",
122        answers = [],
123    ),
124    'Regular Expression in Programming Languages': lms.model.quizzes.Question(
125        id = '110000202',
126        question_type = quizcomp.question.base.QuestionType.TF,
127        name = 'Regular Expression in Programming Languages',
128        points = 1.0,
129        prompt = "Regular expressions are implemented as either a core feature or in the standard library of almost every major programming language.",
130        answers = [
131            {
132                "correct": True,
133                "text": "True"
134            },
135            {
136                "correct": False,
137                "text": "False"
138            }
139        ],
140    ),
141    'Regular Expression Vocabulary': lms.model.quizzes.Question(
142        id = '110000203',
143        question_type = quizcomp.question.base.QuestionType.MATCHING,
144        name = 'Regular Expression Vocabulary',
145        points = 1.0,
146        prompt = "Match the following terms to their corresponding definitions.",
147        answers = {
148            "matches": [
149                [
150                    "Character Class",
151                    "A set of character where any single member of the group can be matched."
152                ],
153                [
154                    "Anchor",
155                    "A special character that can be used to match the beginning or end of a line."
156                ],
157                [
158                    "Word Boundary",
159                    "The empty string between ([\\W^] and \\w) or between (\\w and [\\W$])."
160                ],
161                [
162                    "Kleene Star",
163                    "A repetition operator that matches the range [0, infinity]."
164                ],
165                [
166                    "Group",
167                    "A collection of character that can be treated as a single unit."
168                ],
169                [
170                    "Disjunction",
171                    "An operator that allows us to select one of two options."
172                ],
173                [
174                    "Back Reference",
175                    "A special character that allows us to invoke a previous group."
176                ]
177            ],
178            "distractors": [
179                "The set of all alphanumeric characters and underscore.",
180                "All digits.",
181                "A repetition operator that matches the range [1, infinity].",
182                "An operator that allows us to select both of two options."
183            ]
184        },
185    ),
186    'Basic Regular Expressions': lms.model.quizzes.Question(
187        id = '110000204',
188        question_type = quizcomp.question.base.QuestionType.MCQ,
189        name = 'Basic Regular Expressions',
190        points = 1.0,
191        prompt = "Which of the following regular expressions would be best to match a 10-digit phone number formatted as: '123 456-7890'. (Assume any stretch of continuous whitespace is a single space character.)",
192        answers = [
193            {
194                "correct": True,
195                "text": "`r'\\d{3} \\d{3}-\\d{4}'`"
196            },
197            {
198                "correct": False,
199                "text": "`r'\\d{10}'`"
200            },
201            {
202                "correct": False,
203                "text": "`r'\\d* \\d*-\\d*'`"
204            },
205            {
206                "correct": False,
207                "text": "`r'\\d+ \\d+-\\d+'`"
208            }
209        ],
210    ),
211    'Question': lms.model.quizzes.Question(
212        id = '110000205',
213        question_type = quizcomp.question.base.QuestionType.TEXT_ONLY,
214        name = 'Question',
215        points = 0.0,
216        prompt = "Below is the opening paragraph (which is actually just one sentence) from _A Tale Of Two Cities_ written by Charles Dickens. Future questions may reference this passage as \"the provided passage\".\n\n\"It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way \u2014 in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.\"",
217        answers = [],
218    ),
219    'Passage Search': lms.model.quizzes.Question(
220        id = '110000206',
221        question_type = quizcomp.question.base.QuestionType.NUMERICAL,
222        name = 'Passage Search',
223        points = 1.0,
224        prompt = "In the provided passage, how many non-specific time periods are mentioned, i.e., how many matches are there for the following regular expression:\n```\n    r'(age|season|epoch)\\s+of\\s+(\\w+)'\n    \n```",
225        answers = [
226            {
227                "type": "exact",
228                "value": 6.0,
229                "margin": 0
230            }
231        ],
232    ),
233    'Quantifiers': lms.model.quizzes.Question(
234        id = '110000207',
235        question_type = quizcomp.question.base.QuestionType.MDD,
236        name = 'Quantifiers',
237        points = 1.0,
238        prompt = "For each scenario, select the quantifier that is most appropriate.\n\nYou want to match the leading zeros for some number. E.g., \"00\" for \"005\".  \n<placeholder>PART1</placeholder>\n\nYou want to match the negative sign for some number. E.g., \"-\" for \"-9\".  \n<placeholder>PART2</placeholder>\n\nYou want to match the main digits (before any decimal point) for a required number, e.g., \"123\" for \"123\".  \n<placeholder>PART3</placeholder>",
239        answers = {
240            "PART1": {
241                "text": "PART1",
242                "values": [
243                    {
244                        "correct": False,
245                        "text": "?"
246                    },
247                    {
248                        "correct": True,
249                        "text": "*"
250                    },
251                    {
252                        "correct": False,
253                        "text": "+"
254                    }
255                ]
256            },
257            "PART2": {
258                "text": "PART2",
259                "values": [
260                    {
261                        "correct": True,
262                        "text": "?"
263                    },
264                    {
265                        "correct": False,
266                        "text": "*"
267                    },
268                    {
269                        "correct": False,
270                        "text": "+"
271                    }
272                ]
273            },
274            "PART3": {
275                "text": "PART3",
276                "values": [
277                    {
278                        "correct": False,
279                        "text": "?"
280                    },
281                    {
282                        "correct": False,
283                        "text": "*"
284                    },
285                    {
286                        "correct": True,
287                        "text": "+"
288                    }
289                ]
290            }
291        },
292    ),
293    'General Quantification 1': lms.model.quizzes.Question(
294        id = '110000208',
295        question_type = quizcomp.question.base.QuestionType.MA,
296        name = 'General Quantification',
297        points = 1.0,
298        prompt = "Which of the following does the regex `r'Lo{2,3}ng Cat'` match? Select all that apply.",
299        answers = [
300            {
301                "correct": False,
302                "text": "Long Cat"
303            },
304            {
305                "correct": True,
306                "text": "Loong Cat"
307            },
308            {
309                "correct": True,
310                "text": "Looong Cat"
311            },
312            {
313                "correct": False,
314                "text": "Loooong Cat"
315            }
316        ],
317    ),
318    'General Quantification 2': lms.model.quizzes.Question(
319        id = '110000209',
320        question_type = quizcomp.question.base.QuestionType.MA,
321        name = 'General Quantification',
322        points = 1.0,
323        prompt = "Which of the following does the regex `r'I'm So{3,4} Hungry!'` match? Select all that apply.",
324        answers = [
325            {
326                "correct": False,
327                "text": "I'm So Hungry!"
328            },
329            {
330                "correct": False,
331                "text": "I'm Soo Hungry!"
332            },
333            {
334                "correct": True,
335                "text": "I'm Sooo Hungry!"
336            },
337            {
338                "correct": True,
339                "text": "I'm Soooo Hungry!"
340            }
341        ],
342    ),
343    'Backreference Matching': lms.model.quizzes.Question(
344        id = '110000210',
345        question_type = quizcomp.question.base.QuestionType.FIMB,
346        name = 'Backreference Matching',
347        points = 1.0,
348        prompt = "Suppose that we are trying to write a script extract name information from text and put it into a CSV (comma-separated value) file. The order of the columns in our CSV file are: first name, last name, and title. As part of our script, we have a regular expression that looks for people that have their name's written as \"last, first\".\n```\n    import re\n    \n    def create_csv_line(text_line):\n        regex = r'^\\s*((Dr).?)?\\s*([^,]+)\\s*,\\s*(.+)\\s*$'\n        replacement = MY_REPLACEMENT_STRING\n    \n        return re.sub(regex, replacement, text_line)\n    \n```\n\nFill in the blanks in `MY_REPLACEMENT_STRING` to make the above code work correctly.\n\n`MY_REPLACEMENT_STRING = r'`<placeholder>A</placeholder>`,`<placeholder>B</placeholder>`,`<placeholder>C</placeholder>`'`",
349        answers = {
350            "A": [
351                "\\4"
352            ],
353            "B": [
354                "\\3"
355            ],
356            "C": [
357                "\\2"
358            ]
359        },
360    ),
361    'Regex Golf': lms.model.quizzes.Question(
362        id = '110000211',
363        question_type = quizcomp.question.base.QuestionType.FITB,
364        name = 'Regex Golf',
365        points = 1.0,
366        prompt = "Create a regular expression that matches successfully completes a game a golf with the table below.\n\nSpecifics:\n\n  * Match all values in the `Match` column.\n  * Do not match any values in the `No Match` column.\n  * Write you regex as a raw string using a single or double quotes (not triple quotes).\n  * Treat the contents of each table cell as a string (so you do not have the match the quotes).\n  * You may assume that any contiguous whitespace is a single space character.\n  * You only need to match (or not match) the values in the table, you do not need to extend this pattern to unseen values.\n\nMatch| No Match  \n---|---  \n`'12:00 AM'`| `'00:00'`  \n`'05:30 PM'`| `'17:30'`  \n`'01:45 AM'`| `'01:65 AM'`  \n`'10:10 PM'`| `'10:10 ZZ'`  \n`'12:34 PM'`| `'12:34 pm'`  \n`'11:59 PM'`| `'23:59'`  \n| `'123:45 AM'`  \n| `'12:345 PM'`",
367        answers = [
368            "r'\\d\\d:\\d\\d [AP]M'",
369            "r\"\\d\\d:\\d\\d [AP]M\"",
370            "r'\\d{2}:\\d{2} [AP]M'",
371            "r\"\\d{2}:\\d{2} [AP]M\""
372        ],
373    ),
374    'Write a Function': lms.model.quizzes.Question(
375        id = '110000212',
376        question_type = quizcomp.question.base.QuestionType.ESSAY,
377        name = 'Write a Function',
378        points = 1.0,
379        prompt = "Implement a function with the following signature and description:\n```\n    import re\n    \n    def compute(text):\n        \"\"\"\n        Compute the result of the binary expression represented in the |text| variable.\n        The possible operators are: \"+\", \"-\", \"*\", and \"/\".\n        Operands may be any real number.\n        If the operation is division, the RHS (denominator) will not be zero.\n        \"\"\"\n    \n        return NotImplemented\n    \n```\n\nSpecifics:\n\n  * Your function must use regular expressions.\n  * You may not use `eval()` or any other Python ast functionality.\n  * You may only import modules from the Python standard library.\n  * You should return a float that is the result of the binary operation represented by `text`.\n  * The operator will be one of: {+,\u2212,\u2217,/}\\\\{+, -, *, /\\\\}.\n  * Operands may be any real number.",
380        answers = [],
381    ),
382}
383
384ORDERED_QUIZ_QUESTIONS['Regular Expressions'] = [
385    QUIZ_QUESTIONS['Regular Expressions']['Ice Breaker'],
386    QUIZ_QUESTIONS['Regular Expressions']['Regular Expression in Programming Languages'],
387    QUIZ_QUESTIONS['Regular Expressions']['Regular Expression Vocabulary'],
388    QUIZ_QUESTIONS['Regular Expressions']['Basic Regular Expressions'],
389    QUIZ_QUESTIONS['Regular Expressions']['Question'],
390    QUIZ_QUESTIONS['Regular Expressions']['Passage Search'],
391    QUIZ_QUESTIONS['Regular Expressions']['Quantifiers'],
392    QUIZ_QUESTIONS['Regular Expressions']['General Quantification 1'],
393    QUIZ_QUESTIONS['Regular Expressions']['General Quantification 2'],
394    QUIZ_QUESTIONS['Regular Expressions']['Backreference Matching'],
395    QUIZ_QUESTIONS['Regular Expressions']['Regex Golf'],
396    QUIZ_QUESTIONS['Regular Expressions']['Write a Function'],
397]
COURSE_QUIZZES: Dict[str, Dict[str, lms.model.quizzes.Quiz]] = {'Course 101': {'Regular Expressions': {"close_date": null, "description": "This quiz is open note, open book, and open world. Assume all regular expressions are done in Python using the `re` standard library. Good luck!\n\n \n\n\n* * *\n\nVersion: UNKNOWN", "due_date": null, "extra_fields": {}, "id": "110000200", "name": "Regular Expressions", "open_date": null, "points_possible": 0.0, "resources": []}}}
QUIZ_GROUPS: Dict[str, Dict[str, lms.model.quizzes.QuestionGroup]] = {'Regular Expressions': {'Ice Breaker': {"extra_fields": {}, "id": "110000201", "name": "Ice Breaker", "pick_count": 1, "points": 5.0}, 'Regular Expression in Programming Languages': {"extra_fields": {}, "id": "110000202", "name": "Regular Expression in Programming Languages", "pick_count": 1, "points": 5.0}, 'Regular Expression Vocabulary': {"extra_fields": {}, "id": "110000203", "name": "Regular Expression Vocabulary", "pick_count": 1, "points": 20.0}, 'Basic Regular Expressions': {"extra_fields": {}, "id": "110000204", "name": "Basic Regular Expressions", "pick_count": 1, "points": 5.0}, 'Passage': {"extra_fields": {}, "id": "110000205", "name": "Passage", "pick_count": 1, "points": 0.0}, 'Passage Search': {"extra_fields": {}, "id": "110000206", "name": "Passage Search", "pick_count": 1, "points": 10.0}, 'Quantifiers': {"extra_fields": {}, "id": "110000207", "name": "Quantifiers", "pick_count": 1, "points": 5.0}, 'General Quantification': {"extra_fields": {}, "id": "110000208", "name": "General Quantification", "pick_count": 1, "points": 5.0}, 'Backreference Matching': {"extra_fields": {}, "id": "110000209", "name": "Backreference Matching", "pick_count": 1, "points": 10.0}, 'Regex Golf': {"extra_fields": {}, "id": "110000210", "name": "Regex Golf", "pick_count": 1, "points": 15.0}, 'Write a Function': {"extra_fields": {}, "id": "110000211", "name": "Write a Function", "pick_count": 1, "points": 20.0}}}
ORDERED_QUIZ_GROUPS: Dict[str, List[lms.model.quizzes.QuestionGroup]] = {'Regular Expressions': [{"extra_fields": {}, "id": "110000201", "name": "Ice Breaker", "pick_count": 1, "points": 5.0}, {"extra_fields": {}, "id": "110000202", "name": "Regular Expression in Programming Languages", "pick_count": 1, "points": 5.0}, {"extra_fields": {}, "id": "110000203", "name": "Regular Expression Vocabulary", "pick_count": 1, "points": 20.0}, {"extra_fields": {}, "id": "110000204", "name": "Basic Regular Expressions", "pick_count": 1, "points": 5.0}, {"extra_fields": {}, "id": "110000205", "name": "Passage", "pick_count": 1, "points": 0.0}, {"extra_fields": {}, "id": "110000206", "name": "Passage Search", "pick_count": 1, "points": 10.0}, {"extra_fields": {}, "id": "110000207", "name": "Quantifiers", "pick_count": 1, "points": 5.0}, {"extra_fields": {}, "id": "110000208", "name": "General Quantification", "pick_count": 1, "points": 5.0}, {"extra_fields": {}, "id": "110000209", "name": "Backreference Matching", "pick_count": 1, "points": 10.0}, {"extra_fields": {}, "id": "110000210", "name": "Regex Golf", "pick_count": 1, "points": 15.0}, {"extra_fields": {}, "id": "110000211", "name": "Write a Function", "pick_count": 1, "points": 20.0}]}
QUIZ_QUESTIONS: Dict[str, Dict[str, lms.model.quizzes.Question]] = {'Regular Expressions': {'Ice Breaker': {"answers": [], "extra_fields": {}, "group_id": null, "id": "110000201", "name": "Ice Breaker", "points": 1.0, "prompt": "Taking inspiration from the XKCD comic below, how would you save the day using regular expressions?\n\n![XKCD Comic 208](http://127.0.0.1:3000/courses/110000000/files/1/preview)", "question_type": "essay", "resources": []}, 'Regular Expression in Programming Languages': {"answers": [{"correct": true, "text": "True"}, {"correct": false, "text": "False"}], "extra_fields": {}, "group_id": null, "id": "110000202", "name": "Regular Expression in Programming Languages", "points": 1.0, "prompt": "Regular expressions are implemented as either a core feature or in the standard library of almost every major programming language.", "question_type": "true_false", "resources": []}, 'Regular Expression Vocabulary': {"answers": {"distractors": ["The set of all alphanumeric characters and underscore.", "All digits.", "A repetition operator that matches the range [1, infinity].", "An operator that allows us to select both of two options."], "matches": [["Character Class", "A set of character where any single member of the group can be matched."], ["Anchor", "A special character that can be used to match the beginning or end of a line."], ["Word Boundary", "The empty string between ([\\W^] and \\w) or between (\\w and [\\W$])."], ["Kleene Star", "A repetition operator that matches the range [0, infinity]."], ["Group", "A collection of character that can be treated as a single unit."], ["Disjunction", "An operator that allows us to select one of two options."], ["Back Reference", "A special character that allows us to invoke a previous group."]]}, "extra_fields": {}, "group_id": null, "id": "110000203", "name": "Regular Expression Vocabulary", "points": 1.0, "prompt": "Match the following terms to their corresponding definitions.", "question_type": "matching", "resources": []}, 'Basic Regular Expressions': {"answers": [{"correct": true, "text": "`r'\\d{3} \\d{3}-\\d{4}'`"}, {"correct": false, "text": "`r'\\d{10}'`"}, {"correct": false, "text": "`r'\\d* \\d*-\\d*'`"}, {"correct": false, "text": "`r'\\d+ \\d+-\\d+'`"}], "extra_fields": {}, "group_id": null, "id": "110000204", "name": "Basic Regular Expressions", "points": 1.0, "prompt": "Which of the following regular expressions would be best to match a 10-digit phone number formatted as: '123 456-7890'. (Assume any stretch of continuous whitespace is a single space character.)", "question_type": "multiple_choice", "resources": []}, 'Question': {"answers": [], "extra_fields": {}, "group_id": null, "id": "110000205", "name": "Question", "points": 0.0, "prompt": "Below is the opening paragraph (which is actually just one sentence) from _A Tale Of Two Cities_ written by Charles Dickens. Future questions may reference this passage as \"the provided passage\".\n\n\"It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way \u2014 in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.\"", "question_type": "text_only", "resources": []}, 'Passage Search': {"answers": [{"margin": 0, "type": "exact", "value": 6.0}], "extra_fields": {}, "group_id": null, "id": "110000206", "name": "Passage Search", "points": 1.0, "prompt": "In the provided passage, how many non-specific time periods are mentioned, i.e., how many matches are there for the following regular expression:\n```\n r'(age|season|epoch)\\s+of\\s+(\\w+)'\n \n```", "question_type": "numerical", "resources": []}, 'Quantifiers': {"answers": {"PART1": {"text": "PART1", "values": [{"correct": false, "text": "?"}, {"correct": true, "text": "*"}, {"correct": false, "text": "+"}]}, "PART2": {"text": "PART2", "values": [{"correct": true, "text": "?"}, {"correct": false, "text": "*"}, {"correct": false, "text": "+"}]}, "PART3": {"text": "PART3", "values": [{"correct": false, "text": "?"}, {"correct": false, "text": "*"}, {"correct": true, "text": "+"}]}}, "extra_fields": {}, "group_id": null, "id": "110000207", "name": "Quantifiers", "points": 1.0, "prompt": "For each scenario, select the quantifier that is most appropriate.\n\nYou want to match the leading zeros for some number. E.g., \"00\" for \"005\". \n<placeholder>PART1</placeholder>\n\nYou want to match the negative sign for some number. E.g., \"-\" for \"-9\". \n<placeholder>PART2</placeholder>\n\nYou want to match the main digits (before any decimal point) for a required number, e.g., \"123\" for \"123\". \n<placeholder>PART3</placeholder>", "question_type": "multiple_dropdowns", "resources": []}, 'General Quantification 1': {"answers": [{"correct": false, "text": "Long Cat"}, {"correct": true, "text": "Loong Cat"}, {"correct": true, "text": "Looong Cat"}, {"correct": false, "text": "Loooong Cat"}], "extra_fields": {}, "group_id": null, "id": "110000208", "name": "General Quantification", "points": 1.0, "prompt": "Which of the following does the regex `r'Lo{2,3}ng Cat'` match? Select all that apply.", "question_type": "multiple_answers", "resources": []}, 'General Quantification 2': {"answers": [{"correct": false, "text": "I'm So Hungry!"}, {"correct": false, "text": "I'm Soo Hungry!"}, {"correct": true, "text": "I'm Sooo Hungry!"}, {"correct": true, "text": "I'm Soooo Hungry!"}], "extra_fields": {}, "group_id": null, "id": "110000209", "name": "General Quantification", "points": 1.0, "prompt": "Which of the following does the regex `r'I'm So{3,4} Hungry!'` match? Select all that apply.", "question_type": "multiple_answers", "resources": []}, 'Backreference Matching': {"answers": {"A": ["\\4"], "B": ["\\3"], "C": ["\\2"]}, "extra_fields": {}, "group_id": null, "id": "110000210", "name": "Backreference Matching", "points": 1.0, "prompt": "Suppose that we are trying to write a script extract name information from text and put it into a CSV (comma-separated value) file. The order of the columns in our CSV file are: first name, last name, and title. As part of our script, we have a regular expression that looks for people that have their name's written as \"last, first\".\n```\n import re\n \n def create_csv_line(text_line):\n regex = r'^\\s*((Dr).?)?\\s*([^,]+)\\s*,\\s*(.+)\\s*$'\n replacement = MY_REPLACEMENT_STRING\n \n return re.sub(regex, replacement, text_line)\n \n```\n\nFill in the blanks in `MY_REPLACEMENT_STRING` to make the above code work correctly.\n\n`MY_REPLACEMENT_STRING = r'`<placeholder>A</placeholder>`,`<placeholder>B</placeholder>`,`<placeholder>C</placeholder>`'`", "question_type": "fill_in_multiple_blanks", "resources": []}, 'Regex Golf': {"answers": ["r'\\d\\d:\\d\\d [AP]M'", "r\"\\d\\d:\\d\\d [AP]M\"", "r'\\d{2}:\\d{2} [AP]M'", "r\"\\d{2}:\\d{2} [AP]M\""], "extra_fields": {}, "group_id": null, "id": "110000211", "name": "Regex Golf", "points": 1.0, "prompt": "Create a regular expression that matches successfully completes a game a golf with the table below.\n\nSpecifics:\n\n * Match all values in the `Match` column.\n * Do not match any values in the `No Match` column.\n * Write you regex as a raw string using a single or double quotes (not triple quotes).\n * Treat the contents of each table cell as a string (so you do not have the match the quotes).\n * You may assume that any contiguous whitespace is a single space character.\n * You only need to match (or not match) the values in the table, you do not need to extend this pattern to unseen values.\n\nMatch| No Match \n---|--- \n`'12:00 AM'`| `'00:00'` \n`'05:30 PM'`| `'17:30'` \n`'01:45 AM'`| `'01:65 AM'` \n`'10:10 PM'`| `'10:10 ZZ'` \n`'12:34 PM'`| `'12:34 pm'` \n`'11:59 PM'`| `'23:59'` \n| `'123:45 AM'` \n| `'12:345 PM'`", "question_type": "fill_in_the_blank", "resources": []}, 'Write a Function': {"answers": [], "extra_fields": {}, "group_id": null, "id": "110000212", "name": "Write a Function", "points": 1.0, "prompt": "Implement a function with the following signature and description:\n```\n import re\n \n def compute(text):\n \"\"\"\n Compute the result of the binary expression represented in the |text| variable.\n The possible operators are: \"+\", \"-\", \"*\", and \"/\".\n Operands may be any real number.\n If the operation is division, the RHS (denominator) will not be zero.\n \"\"\"\n \n return NotImplemented\n \n```\n\nSpecifics:\n\n * Your function must use regular expressions.\n * You may not use `eval()` or any other Python ast functionality.\n * You may only import modules from the Python standard library.\n * You should return a float that is the result of the binary operation represented by `text`.\n * The operator will be one of: {+,\u2212,\u2217,/}\\\\{+, -, *, /\\\\}.\n * Operands may be any real number.", "question_type": "essay", "resources": []}}}
ORDERED_QUIZ_QUESTIONS: Dict[str, List[lms.model.quizzes.Question]] = {'Regular Expressions': [{"answers": [], "extra_fields": {}, "group_id": null, "id": "110000201", "name": "Ice Breaker", "points": 1.0, "prompt": "Taking inspiration from the XKCD comic below, how would you save the day using regular expressions?\n\n![XKCD Comic 208](http://127.0.0.1:3000/courses/110000000/files/1/preview)", "question_type": "essay", "resources": []}, {"answers": [{"correct": true, "text": "True"}, {"correct": false, "text": "False"}], "extra_fields": {}, "group_id": null, "id": "110000202", "name": "Regular Expression in Programming Languages", "points": 1.0, "prompt": "Regular expressions are implemented as either a core feature or in the standard library of almost every major programming language.", "question_type": "true_false", "resources": []}, {"answers": {"distractors": ["The set of all alphanumeric characters and underscore.", "All digits.", "A repetition operator that matches the range [1, infinity].", "An operator that allows us to select both of two options."], "matches": [["Character Class", "A set of character where any single member of the group can be matched."], ["Anchor", "A special character that can be used to match the beginning or end of a line."], ["Word Boundary", "The empty string between ([\\W^] and \\w) or between (\\w and [\\W$])."], ["Kleene Star", "A repetition operator that matches the range [0, infinity]."], ["Group", "A collection of character that can be treated as a single unit."], ["Disjunction", "An operator that allows us to select one of two options."], ["Back Reference", "A special character that allows us to invoke a previous group."]]}, "extra_fields": {}, "group_id": null, "id": "110000203", "name": "Regular Expression Vocabulary", "points": 1.0, "prompt": "Match the following terms to their corresponding definitions.", "question_type": "matching", "resources": []}, {"answers": [{"correct": true, "text": "`r'\\d{3} \\d{3}-\\d{4}'`"}, {"correct": false, "text": "`r'\\d{10}'`"}, {"correct": false, "text": "`r'\\d* \\d*-\\d*'`"}, {"correct": false, "text": "`r'\\d+ \\d+-\\d+'`"}], "extra_fields": {}, "group_id": null, "id": "110000204", "name": "Basic Regular Expressions", "points": 1.0, "prompt": "Which of the following regular expressions would be best to match a 10-digit phone number formatted as: '123 456-7890'. (Assume any stretch of continuous whitespace is a single space character.)", "question_type": "multiple_choice", "resources": []}, {"answers": [], "extra_fields": {}, "group_id": null, "id": "110000205", "name": "Question", "points": 0.0, "prompt": "Below is the opening paragraph (which is actually just one sentence) from _A Tale Of Two Cities_ written by Charles Dickens. Future questions may reference this passage as \"the provided passage\".\n\n\"It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way \u2014 in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.\"", "question_type": "text_only", "resources": []}, {"answers": [{"margin": 0, "type": "exact", "value": 6.0}], "extra_fields": {}, "group_id": null, "id": "110000206", "name": "Passage Search", "points": 1.0, "prompt": "In the provided passage, how many non-specific time periods are mentioned, i.e., how many matches are there for the following regular expression:\n```\n r'(age|season|epoch)\\s+of\\s+(\\w+)'\n \n```", "question_type": "numerical", "resources": []}, {"answers": {"PART1": {"text": "PART1", "values": [{"correct": false, "text": "?"}, {"correct": true, "text": "*"}, {"correct": false, "text": "+"}]}, "PART2": {"text": "PART2", "values": [{"correct": true, "text": "?"}, {"correct": false, "text": "*"}, {"correct": false, "text": "+"}]}, "PART3": {"text": "PART3", "values": [{"correct": false, "text": "?"}, {"correct": false, "text": "*"}, {"correct": true, "text": "+"}]}}, "extra_fields": {}, "group_id": null, "id": "110000207", "name": "Quantifiers", "points": 1.0, "prompt": "For each scenario, select the quantifier that is most appropriate.\n\nYou want to match the leading zeros for some number. E.g., \"00\" for \"005\". \n<placeholder>PART1</placeholder>\n\nYou want to match the negative sign for some number. E.g., \"-\" for \"-9\". \n<placeholder>PART2</placeholder>\n\nYou want to match the main digits (before any decimal point) for a required number, e.g., \"123\" for \"123\". \n<placeholder>PART3</placeholder>", "question_type": "multiple_dropdowns", "resources": []}, {"answers": [{"correct": false, "text": "Long Cat"}, {"correct": true, "text": "Loong Cat"}, {"correct": true, "text": "Looong Cat"}, {"correct": false, "text": "Loooong Cat"}], "extra_fields": {}, "group_id": null, "id": "110000208", "name": "General Quantification", "points": 1.0, "prompt": "Which of the following does the regex `r'Lo{2,3}ng Cat'` match? Select all that apply.", "question_type": "multiple_answers", "resources": []}, {"answers": [{"correct": false, "text": "I'm So Hungry!"}, {"correct": false, "text": "I'm Soo Hungry!"}, {"correct": true, "text": "I'm Sooo Hungry!"}, {"correct": true, "text": "I'm Soooo Hungry!"}], "extra_fields": {}, "group_id": null, "id": "110000209", "name": "General Quantification", "points": 1.0, "prompt": "Which of the following does the regex `r'I'm So{3,4} Hungry!'` match? Select all that apply.", "question_type": "multiple_answers", "resources": []}, {"answers": {"A": ["\\4"], "B": ["\\3"], "C": ["\\2"]}, "extra_fields": {}, "group_id": null, "id": "110000210", "name": "Backreference Matching", "points": 1.0, "prompt": "Suppose that we are trying to write a script extract name information from text and put it into a CSV (comma-separated value) file. The order of the columns in our CSV file are: first name, last name, and title. As part of our script, we have a regular expression that looks for people that have their name's written as \"last, first\".\n```\n import re\n \n def create_csv_line(text_line):\n regex = r'^\\s*((Dr).?)?\\s*([^,]+)\\s*,\\s*(.+)\\s*$'\n replacement = MY_REPLACEMENT_STRING\n \n return re.sub(regex, replacement, text_line)\n \n```\n\nFill in the blanks in `MY_REPLACEMENT_STRING` to make the above code work correctly.\n\n`MY_REPLACEMENT_STRING = r'`<placeholder>A</placeholder>`,`<placeholder>B</placeholder>`,`<placeholder>C</placeholder>`'`", "question_type": "fill_in_multiple_blanks", "resources": []}, {"answers": ["r'\\d\\d:\\d\\d [AP]M'", "r\"\\d\\d:\\d\\d [AP]M\"", "r'\\d{2}:\\d{2} [AP]M'", "r\"\\d{2}:\\d{2} [AP]M\""], "extra_fields": {}, "group_id": null, "id": "110000211", "name": "Regex Golf", "points": 1.0, "prompt": "Create a regular expression that matches successfully completes a game a golf with the table below.\n\nSpecifics:\n\n * Match all values in the `Match` column.\n * Do not match any values in the `No Match` column.\n * Write you regex as a raw string using a single or double quotes (not triple quotes).\n * Treat the contents of each table cell as a string (so you do not have the match the quotes).\n * You may assume that any contiguous whitespace is a single space character.\n * You only need to match (or not match) the values in the table, you do not need to extend this pattern to unseen values.\n\nMatch| No Match \n---|--- \n`'12:00 AM'`| `'00:00'` \n`'05:30 PM'`| `'17:30'` \n`'01:45 AM'`| `'01:65 AM'` \n`'10:10 PM'`| `'10:10 ZZ'` \n`'12:34 PM'`| `'12:34 pm'` \n`'11:59 PM'`| `'23:59'` \n| `'123:45 AM'` \n| `'12:345 PM'`", "question_type": "fill_in_the_blank", "resources": []}, {"answers": [], "extra_fields": {}, "group_id": null, "id": "110000212", "name": "Write a Function", "points": 1.0, "prompt": "Implement a function with the following signature and description:\n```\n import re\n \n def compute(text):\n \"\"\"\n Compute the result of the binary expression represented in the |text| variable.\n The possible operators are: \"+\", \"-\", \"*\", and \"/\".\n Operands may be any real number.\n If the operation is division, the RHS (denominator) will not be zero.\n \"\"\"\n \n return NotImplemented\n \n```\n\nSpecifics:\n\n * Your function must use regular expressions.\n * You may not use `eval()` or any other Python ast functionality.\n * You may only import modules from the Python standard library.\n * You should return a float that is the result of the binary operation represented by `text`.\n * The operator will be one of: {+,\u2212,\u2217,/}\\\\{+, -, *, /\\\\}.\n * Operands may be any real number.", "question_type": "essay", "resources": []}]}