# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
264 lines (244 sloc) 15.7 KB
\$.map( new Array( 5 ), function() { return randRange( 12, 20 ) * 5; } ) \$.map( new Array( 5 ), function() { return randRange( 12, 20 ) * 5; } ) \$.map( new Array( 5 ), function( e, n ) { return FINAL[ n ] - MIDTERM[ n ]; } ) \$.map( IMPROVEMENT, function( x ) { return x > 0 ? 1 : null; }).length IMPROVEMENT.slice().sort(function(a,b){return a - b;})[4] === IMPROVEMENT.slice().sort(function(a,b){return a - b;})[3] false

Use the following graph to answer the question below:

init({ range: [ [ -2, 17 ], [ -3, 11 ] ], scale: [ 30, 30 ] }); for ( var y = 1; y <= 10; ++y ) { label( [ 0, y ], y * 10, "left", false ); style({ stroke: "#000", strokeWidth: 1, opacity: 0.2 }, function() { line( [ 0, y ], [ 16, y ] ) }); } for ( var index = 0; index < 5; ++index ) { style({ stroke: "none", fill: "#9ab8ed", opacity: 1.0 }); path([ [ index * 3 + 1, 0 ], [ index * 3 + 1, MIDTERM[ index ] / 10 ], [ index * 3 + 2, MIDTERM[ index ] / 10 ], [ index * 3 + 2, 0 ], [ index * 3 + 1, 0 ] ]); style({ stroke: "none", fill: "#ffc966", opacity: 1.0 }); path([ [ index * 3 + 2, 0 ], [ index * 3 + 2, FINAL[ index ] / 10 ], [ index * 3 + 3, FINAL[ index ] / 10 ], [ index * 3 + 3, 0 ], [ index * 3 + 2, 0 ] ]); style({ opacity: 1.0 }); label( [ index * 3 + 2, 0 ], person( index + 1 ), "below", false ); } style({ stroke: "#000", strokeWidth: 2, opacity: 1.0 }); line( [ 0, 0 ], [ 16, 0 ] ); line( [ 0, 0 ], [ 0, 10 ] ); label( [ 8, -0.8 ], "<b>Student</b>", "below", false ); \$( label( [ -1.5, 5 ], "<b>Score (points)</b>", "center", false ) ).addClass( "rotate" ); label( [ 8, 10.5 ], "<b>Scores on Midterm and Final Exams</b>", "above", false ); style({ stroke: "none", fill: "#9ab8ed", opacity: 1.0 }); path([ [ 0, -2 ], [ 0.5, -2 ], [ 0.5, -2.5 ], [ 0, -2.5 ], [ 0, -2 ] ]); style({ stroke: "#000", strokeWidth: 2, opacity: 1.0 }); label( [ 0.5, -2.25 ], "Midterm", "right", false ); style({ stroke: "none", fill: "#ffc966", opacity: 1.0 }); path([ [ 3, -2 ], [ 3.5, -2 ], [ 3.5, -2.5 ], [ 3, -2.5 ], [ 3, -2 ] ]); style({ stroke: "#000", strokeWidth: 2, opacity: 1.0 }); label( [ 3.5, -2.25 ], "Final", "right", false );
Math.max.apply( Math, IMPROVEMENT ) _.indexOf( IMPROVEMENT, BEST_IMPROVEMENT ) person( MOST_IMPROVED_IDX + 1 )

Which student's score improved the most between the midterm and final exams?

MOST_IMPROVED
• person( 1 )
• person( 2 )
• person( 3 )
• person( 4 )
• person( 5 )

person( INDEX + 1 )'s final exam bar is taller than his( INDEX + 1 ) midterm bar, so person( INDEX + 1 ) improved his( INDEX + 1 ) score. His( INDEX + 1 ) midterm score was MIDTERM[ INDEX ] and his( INDEX + 1 ) final exam score was FINAL[ INDEX ], so he( INDEX + 1 ) improved by IMPROVEMENT[ INDEX ] points.

style({ stroke: GREEN, strokeWidth: 2, arrows: "->" }); line( [ INDEX * 3 + 1.5, MIDTERM[ INDEX ] / 10 ], [ INDEX * 3 + 2.5, FINAL[ INDEX ] / 10 ] ); label( [ INDEX * 3 + 1.5, MIDTERM[ INDEX ] / 10 + 0.2 ], MIDTERM[ INDEX ], "below", false ).css({ fontWeight: "bold" }); label( [ INDEX * 3 + 2.5, FINAL[ INDEX ] / 10 - 0.2 ], FINAL[ INDEX ], "above", false ).css({ fontWeight: "bold" });

person( INDEX + 1 )'s final exam bar is shorter than his( INDEX + 1 ) midterm bar, so person( INDEX + 1 ) did not improve his( INDEX + 1 ) score.

style({ stroke: "grey", strokeWidth: 2, arrows: "->" }); line( [ INDEX * 3 + 1.5, MIDTERM[ INDEX ] / 10 ], [ INDEX * 3 + 2.5, FINAL[ INDEX ] / 10 ] );

person( INDEX + 1 )'s final exam bar is the same height as his( INDEX + 1 ) midterm bar, so person( INDEX + 1 ) did not improve his( INDEX + 1 ) score.

MOST_IMPROVED improved his( MOST_IMPROVED_IDX + 1 ) score the most, scoring BEST_IMPROVEMENT more points on his( MOST_IMPROVED_IDX + 1 ) final exam than on his( MOST_IMPROVED_IDX + 1 ) midterm.

randRange( 0, 4 ) person( INDEX + 1 )

By how many points did STUDENT's score improve from the midterm to the final exam?

IMPROVEMENT[ INDEX ] points

Find the two bars for STUDENT.

style({ stroke: PINK, fill: "none", strokeWidth: 2 }); ellipse( [ INDEX * 3 + 2, -0.6 ], [ 1.2, 0.5 ] );

Compare the height of STUDENT's blue bar to the scale on the left to find his( INDEX + 1 ) midterm score. The bar's height is halfway between MIDTERM[ INDEX ] - 5 and MIDTERM[ INDEX ] + 5, so STUDENT earned MIDTERM[ INDEX ] points on the midterm.

style({ stroke: BLUE, strokeWidth: 2, arrows: "->", strokeDasharray: "-" }); line( [ INDEX * 3 + 1, MIDTERM[ INDEX ] / 10 ], [ 0, MIDTERM[ INDEX ] / 10 ] );

Compare the height of STUDENT's orange bar to the scale on the left to find his( INDEX + 1 ) final exam score. The bar's height is halfway between FINAL[ INDEX ] - 5 and FINAL[ INDEX ] + 5, so STUDENT earned FINAL[ INDEX ] points on the final exam.

style({ stroke: ORANGE, strokeWidth: 2, arrows: "->", strokeDasharray: "-" }); line( [ INDEX * 3 + 2, FINAL[ INDEX ] / 10 ], [ 0, FINAL[ INDEX ] / 10 ] );

Subtract the midterm score from the final exam score to find out how much STUDENT improved.

\color{ORANGE}{FINAL[ INDEX ]} - \color{#6495ED}{MIDTERM[ INDEX ]} = IMPROVEMENT[ INDEX ], so STUDENT improved by IMPROVEMENT[ INDEX ] points from the midterm to the final exam.

randRange( 0, 4 ) person( INDEX + 1 ) randRange( 0, 1 ) [ "midterm", "final exam" ][ COLUMN ] COLUMN === 0 ? MIDTERM[ INDEX ] : FINAL[ INDEX ]

How many points did STUDENT earn on the TEST?

Find the two bars for STUDENT.

style({ stroke: PINK, fill: "none", strokeWidth: 2 }); ellipse( [ INDEX * 3 + 2, -0.6 ], [ 1.2, 0.5 ] );

Use the key to figure out which of the two bars shows the score for the TEST.

style({ stroke: PINK, fill: "none", strokeWidth: 2 }); ellipse( [ COLUMN * 3 + 1.2, -2.25 ], [ 1.5, 0.5 ] );

Compare the height of STUDENT's blueorange bar to the scale on the left.

style({ stroke: PINK, strokeWidth: 2, arrows: "->", strokeDasharray: "-" }); line( [ INDEX * 3 + 1 + COLUMN, ANSWER / 10 ], [ 0, ANSWER / 10 ] );

The bar's height is halfway between ANSWER - 5 and ANSWER + 5, so STUDENT earned ANSWER points on the TEST.

STUDENT earned ANSWER points on the TEST.

How many students improved their scores from the midterm to the final exam?

NUM_IMPROVED students

person( INDEX + 1 )'s final exam bar is taller than his( INDEX + 1 ) midterm bar, so person( INDEX + 1 ) improved his( INDEX + 1 ) score.

style({ stroke: "grey", strokeWidth: 2, arrows: "->" }); line( [ INDEX * 3 + 1.5, MIDTERM[ INDEX ] / 10 ], [ INDEX * 3 + 2.5, FINAL[ INDEX ] / 10 ] );

person( INDEX + 1 )'s final exam bar is shorter than his( INDEX + 1 ) midterm bar, so person( INDEX + 1 ) did not improve his( INDEX + 1 ) score.

person( INDEX + 1 )'s final exam bar is the same height as his( INDEX + 1 ) midterm bar, so person( INDEX + 1 ) did not improve his( INDEX + 1 ) score.

Count the number of students who improved their scores.

NUM_IMPROVED students improved their scores from the midterm to the final exam.

Something went wrong with that request. Please try again.