// Numbas version: exam_results_page_options {"name": "Applied modulo arithmetic: AM or PM", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"type": "gapfill", "marks": 0, "variableReplacements": [], "prompt": "

A digital clock has an AM/PM button which changes whether the clock displays AM or PM. If the clock originally displayed {state1}, what did the clock display after {name1} pressed the button {offset} times?

\n

\n

[[0]]

", "scripts": {}, "gaps": [{"type": "1_n_2", "minMarks": 0, "shuffleChoices": false, "marks": 0, "matrix": ["if(state2number=0,1,0)", "if(state2number=1,1,0)"], "showFeedbackIcon": true, "displayType": "radiogroup", "distractors": ["", ""], "variableReplacements": [], "choices": ["

AM

", "

PM

"], "scripts": {}, "displayColumns": 0, "maxMarks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true}], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true}], "advice": "

There are $2$ states (AM and PM) so to do a question such as the above we should work modulo $2$.

\n

Since $\\var{offset}\\div 2=\\var{floor(offset/2)}$$\\frac{\\var{modoffset}}{2}$, when it comes which state is displayed, '$\\var{offset}$ changes' is the same as '$\\var{modoffset}$ changes'.

\n

Since we started with {state1}, $\\var{modoffset}$ changes gives us {state2}.

", "variables": {"name1": {"name": "name1", "definition": "random(['Ben','Annie', 'Clinton', 'Annette', 'Jill', 'David', 'Fran', 'Andrew', 'Keith', 'Abbey', 'Sophie', 'John', 'Simon', 'Klee', 'Daniel', 'Jason', 'Tom', 'Matt', 'Stephan','Elizabeth'])", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "state2number": {"name": "state2number", "definition": "mod(state1number+offset,2)", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "offset": {"name": "offset", "definition": "random(15..200)", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "state1number": {"name": "state1number", "definition": "random(0..1)", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "state1": {"name": "state1", "definition": "stateList[state1number]", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "stateList": {"name": "stateList", "definition": "['AM', 'PM']", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "modoffset": {"name": "modoffset", "definition": "mod(offset,2)", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "state2": {"name": "state2", "definition": "stateList[state2number]", "group": "Ungrouped variables", "templateType": "anything", "description": ""}}, "rulesets": {}, "extensions": [], "tags": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": "

Applied questions that could be done with modulo arithmetic.

"}, "ungrouped_variables": ["offset", "stateList", "state1number", "state1", "state2number", "state2", "name1", "modoffset"], "statement": "

Modulo arithmetic can help in situations where a finite number of cases is continually cycled through. 

", "variable_groups": [], "name": "Applied modulo arithmetic: AM or PM", "functions": {}, "preamble": {"css": "", "js": ""}, "type": "question", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}