// Numbas version: exam_results_page_options {"name": "Q2 Rectangle problems", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"rectangle": {"definition": "\n\n var c = document.createElement('canvas');\n $(c).attr('width',w+400).attr('height',h+400);\n var context = c.getContext('2d');\n \n //fill in rectangle with a light shade\n context.fillStyle = '#eee';\n context.fillRect(50,50,w*10,h*10);\n \n //draw outline\n context.strokeStyle = '#000';\n context.lineWidth = 3;\n context.strokeRect(50,50,w*10,h*10);\n \n //draw labels\n context.fillStyle = '#000';\n context.font = '20px sans-serif';\n var wstring = 'x'+'m';\n var tw = context.measureText(wstring).width;\n// console.log(tw);\n context.fillText(wstring,60,38);\n \n var hstring = h+'m';\n var hw = context.measureText(hstring).width;\n context.save();\n context.translate(30,200);\n context.rotate(-Math.PI/2);\n context.fillText(hstring,0,0);\n \n return c;\n ", "type": "html", "language": "javascript", "parameters": [["h", "number"], ["w", "number"]]}}, "ungrouped_variables": ["p", "w", "h", "x", "a", "p1", "w1", "h1", "area1"], "name": "Q2 Rectangle problems", "tags": ["Area", "area", "canvas", "function", "graphic", "Perimeter", "perimeter", "rebelmaths", "rectangle", "Rectangle"], "preamble": {"css": "", "js": ""}, "advice": "

Part 1

\n

Formula for perimeter of rectangle.

\n

Perimeter = $2 \\times$ width $+ 2 \\times$ length

\n

Therefore;

\n

width = $\\frac{(\\text{perimter} - 2 \\times length)}{2}$

\n

$\\frac{(\\var{p} - 2 \\times \\var{h})}{2} = \\var{w}m$

\n

Formula for area of rectangle.

\n

Area = width $\\times$ length 

\n

$\\var{w} \\times \\var{h} = \\var{a}m^2$

\n

\n

Part 2

\n

Formula for area of rectangle.

\n

Area = width $\\times$ length 

\n

$\\frac{\\var{area1}}{\\var{h1} } = \\var{w1}$

\n

Perimeter = $2 \\times$ width $+ 2 \\times$ length

\n

$2 \\times \\var{w1} + 2 \\times \\var{h1} = \\var{p1}m$

\n

\n

", "rulesets": {}, "parts": [{"stepsPenalty": 0, "prompt": "

{rectangle(h,w)}

\n

A rectangle has a perimeter of $\\var{p}m$. If the length is $\\var{h}m$, first calculate its width and then its area. 

\n

width = [[0]]m

\n

area = [[1]]$m^2$

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "steps": [{"prompt": "

First write the perimeter in terms of x.

\n

Solve for x.

\n

Then calculate the area.

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "information"}], "gaps": [{"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "maxValue": "{w}", "strictPrecision": false, "minValue": "{w}", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "2", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "maxValue": "{a}", "strictPrecision": false, "minValue": "{a}", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "2", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"stepsPenalty": 0, "prompt": "

{rectangle(h1,w1)}

\n

Calculate the perimeter of a rectangle which has a length of $\\var{h1}m$, if the area of this rectangle is $\\var{area1}m^2$. First calculate its width.

\n

width = [[0]]m

\n

perimeter = [[1]]$m$

\n

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "steps": [{"prompt": "

First write the areain terms of x.

\n

Next, find the length of side x.

\n

Then find the perimeter.

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "information"}], "gaps": [{"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "maxValue": "{w1}", "strictPrecision": false, "minValue": "{w1}", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "2", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "maxValue": "{p1}", "strictPrecision": false, "minValue": "{p1}", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "2", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": [], "statement": "

Correct to 2 decimal places

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "h*w", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "p1": {"definition": "2*h1+2*w1", "templateType": "anything", "group": "Ungrouped variables", "name": "p1", "description": ""}, "w": {"definition": "random(5..h-6#0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "w", "description": ""}, "h": {"definition": "random(15..34)", "templateType": "anything", "group": "Ungrouped variables", "name": "h", "description": ""}, "h1": {"definition": "random(20..26 except h)", "templateType": "anything", "group": "Ungrouped variables", "name": "h1", "description": ""}, "p": {"definition": "2*h+2*w", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "w1": {"definition": "random(5..h-6#0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "w1", "description": ""}, "x": {"definition": "\"x\"", "templateType": "anything", "group": "Ungrouped variables", "name": "x", "description": ""}, "area1": {"definition": "h1*w1", "templateType": "anything", "group": "Ungrouped variables", "name": "area1", "description": ""}}, "metadata": {"description": "

Area and Perimeter of Rectangles

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "TEAME CIT", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/591/"}]}]}], "contributors": [{"name": "TEAME CIT", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/591/"}]}