// Numbas version: exam_results_page_options {"name": "Converting to 24-hour time", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [["question-resources/clockImage_mod1.svg", "/srv/numbas/media/question-resources/clockImage_mod1.svg"], ["question-resources/clockImage_mod2.svg", "/srv/numbas/media/question-resources/clockImage_mod2.svg"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Converting to 24-hour time", "tags": [], "metadata": {"description": "

Questions that gives either an am or pm time displayed on a 12-hour clock and asks for its equivalent time in 24-hour mode. The question uses JSXGraph to generate the displayed 12-hour time. Times are randomly generated in 5 minute increments.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

{diagram}

", "advice": "

In 24 hour time format the time is written as a four digit number with the first two digits representing the hour of the day and the final two digits minutes past the hour.

\n

Times between midnight and 1 am have the hour digits \"\\(00\\)\", times between 1 am and 12 pm have hour digits the same as the time shown when using a 12 hour system (with a leading \"\\(0\\)\" for times prior to 10 am. For times from 1 pm to 11:59 pm we add 12 to the hour digits, hence 1 pm becomes \"\\(1300\\)\" etc.

\n

In this case the time given is \\(\\var{time}\\;\\var{ampm}\\) and hence we change the hours to \\(00\\) add a leading \\(0\\) leave the time as it is add \\(12\\) to the number of hours to get the 24 hour time as \\(\\var{answer}\\).

", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "jessiecode(\n 400,400, // Dimensions of JSXGraph board (in pixels)\n [-2.2,2.2,2.2,-2.2], // [left,top,right,bottom] in plot coordinates\n \"hourHandCoordsX = {hourHandCoords[0]};hourHandCoordsY = {hourHandCoords[1]};minuteHandCoordsX = {minuteHandCoords[0]};minuteHandCoordsY = {minuteHandCoords[1]};\"+safe(\"\"\"\n im = image('resources/question-resources/clockImage_mod2.svg', [-2.05272,-2.05272],[4.10544,4.10544]) // In plot coordinates: [left x coord, bottom y coord],[distance from right to left, ditance from bottom to top]\n << highlight: false, fixed: true >>;\n\n segment([0,0],[hourHandCoordsX,hourHandCoordsY]) <>;\n segment([0,0],[minuteHandCoordsX,minuteHandCoordsY]) <>;\n\"\"\"),\n [\n \"axis\": false,\n \"grid\": false,\n \"showNavigation\": false,\n \"defaultAxes\": [\"x\": [\"scalable\": true, \"ticks\": [\"insertTicks\": true, \"minorTicks\": 0], \"ticksDelta\": 0.1], \"x\": [\"scalable\": true, \"ticks\": [\"insertTicks\": true, \"minorTicks\": 9], \"ticksDelta\": 0.1]]\n ]\n)", "description": "

JSXGraph clock item. Note that the clockface is the image clockImage_mod2.svg in resources. Segments are the hour and minute hand respectively.

", "templateType": "anything", "can_override": false}, "thetaHours": {"name": "thetaHours", "group": "Ungrouped variables", "definition": "(-30*hours-minutes/2+90)*(pi/180)", "description": "

Angle of hour hand with respect to +ve x axis

", "templateType": "anything", "can_override": false}, "minutes": {"name": "minutes", "group": "Ungrouped variables", "definition": "random(0..55 #5)", "description": "

The minutes as indicated on the 12-hour clock graphic.

", "templateType": "anything", "can_override": false}, "hours": {"name": "hours", "group": "Ungrouped variables", "definition": "random(1..12)", "description": "

The hours as indicated on the 12-hour clock graphic.

", "templateType": "anything", "can_override": false}, "thetaMinutes": {"name": "thetaMinutes", "group": "Ungrouped variables", "definition": "(-6*minutes+90)*(pi/180)", "description": "

Angle of minute hand with respect to +ve x axis

", "templateType": "anything", "can_override": false}, "hourHandCoords": {"name": "hourHandCoords", "group": "Ungrouped variables", "definition": "vector(hourHandRadius*cos(thetaHours),hourHandRadius*sin(thetaHours))", "description": "

Coordinates of terminal point of hour hand.

", "templateType": "anything", "can_override": false}, "minuteHandCoords": {"name": "minuteHandCoords", "group": "Ungrouped variables", "definition": "vector(minuteHandRadius*cos(thetaMinutes),minuteHandRadius*sin(thetaMinutes))", "description": "

Coordinates of terminal point of minute hand.

", "templateType": "anything", "can_override": false}, "hourHandRadius": {"name": "hourHandRadius", "group": "Ungrouped variables", "definition": "0.85", "description": "

Length of hour hand (note default image has clock radius 2)

", "templateType": "anything", "can_override": false}, "minuteHandRadius": {"name": "minuteHandRadius", "group": "Ungrouped variables", "definition": "1.2", "description": "

Length of minute hand (note default image has clock radius 2)

", "templateType": "anything", "can_override": false}, "answer": {"name": "answer", "group": "Ungrouped variables", "definition": "if(ampm=\"pm\",\n if(hours=12,\n switch(minutes=0,string(hours)+\"00\",\n minutes<10,string(hours)+\"0\"+string(minutes),\n string(hours)+string(minutes)),\n switch(minutes=0,string(hours+12)+\"00\",\n minutes<10,string(hours+12)+\"0\"+string(minutes),\n string(hours+12)+string(minutes))),\n switch(hours<10,\n switch(minutes=0,\"0\"+string(hours)+\"00\",\n minutes<10,\"0\"+string(hours)+\"0\"+string(minutes),\n \"0\"+string(hours)+string(minutes)),\n hours<12,\n switch(minutes=0,string(hours)+\"00\",\n minutes<10,string(hours)+\"0\"+string(minutes),\n string(hours)+string(minutes)),\n hours=12,\n switch(minutes=0,\"0000\",\n minutes<10,\"000\"+string(minutes),\n \"00\"+string(minutes))\n))", "description": "

Expected 24-hour time for answer, based on the variables hours, minutes and ampm.

", "templateType": "anything", "can_override": false}, "ampm": {"name": "ampm", "group": "Ungrouped variables", "definition": "random(\"am\",\"pm\")", "description": "

Variable generating random morning/afternoon outputs.

", "templateType": "anything", "can_override": false}, "time": {"name": "time", "group": "Ungrouped variables", "definition": "switch(minutes=0,string(hours)+\":00\",\n minutes<10, string(hours)+\":0\"+string(minutes),\n string(hours)+\":\"+string(minutes))", "description": "

Time as dsiplayed on 12-hour clock graphic.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["diagram", "minutes", "thetaMinutes", "minuteHandCoords", "minuteHandRadius", "hours", "thetaHours", "hourHandCoords", "hourHandRadius", "answer", "ampm", "time"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

The time shown on the clock above is in the morning in the afternoon. What is this time on a 24-hour clock (use the format 1545, include leading zeros if needed)?

\n

[[0]]

", "gaps": [{"type": "patternmatch", "useCustomName": true, "customName": "24HourTime", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{answer}", "displayAnswer": "{answer}", "matchMode": "regex"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Don Shearman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/680/"}, {"name": "Jim Pettigrew", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2037/"}, {"name": "Susan McGlynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2148/"}]}]}], "contributors": [{"name": "Don Shearman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/680/"}, {"name": "Jim Pettigrew", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2037/"}, {"name": "Susan McGlynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2148/"}]}