Please enable JavaScript to use CodeHS

Sample A CSP Performance Task

By David Burnham

Part 1: Full Code

Part 2: Video

Part 3: Written Response

3A.

Provide a written response that does all three of the following: 

i. Describes the overall purpose of the program

ii. Describes what functionality of the program is demonstrated in the video

iii. Describes the input and output of the program demonstrated in the video




The purpose of this program is to test basic math problems in multiplication and division and report the percent correct back to the user. The video demonstrates both the multiplication and division quizzes where the user is asked for the problem type and then given 5 problems, each with a chance to answer and the results reported back.


The video demonstrates 2 different inputs and 3 different outputs. The inputs demonstrated are asking users to select a problem type and then providing a guess for the problems. The three outputs demonstrated are outputting the problem, outputting the results from each guess, and outputting the final score at the end.

3D.

Provide a written response that does all three of the following:

i. Describes two calls to the procedure identified in written response 3c. Each call must pass a different argument(s) that causes a different segment of code in the algorithm to execute.

ii. Describes what condition(s) is being tested by each call to the procedure

iii. Identifies the result of each call



The two test cases are based on passing a different input to create different types of problem in the function (multiplication versus division). The first call will pass the letter M. Based on this call, the program should select a multiplication problems to print out. Inside the loop, the selection statement will execute the first part of the selection statement and print a problem with a * operator. It will also calculate the answer by multiplying the values from the firstNumber and secondNumber lists. The result of the call will be to print 5 multiplication problems and return the number of correct answers.


The second call will pass the letter D. Based on this call, the program should select a multiplication problem. Inside the loop, the selection statement will execute the else clause since D does not equal M. As a result, the code will print a / operator and calculate the answer by dividing the firstNumber value by the secondNumber value. The result of the call will be to print 5 division problems and return the number of correct answers.

Scoring Commentary


6/6

Row 1:

The response earned the point for this row, meeting all six criteria:

• The video demonstrates the program receiving user input for both the problem type and the answers to the problem

• The program's purpose is to create a math quiz and the video demonstrates creating both a multiplication and division quiz.

• The program demonstrates output by creating the problems and displaying the results of each problem and the quiz

• The input and output is described in the response by stating "The inputs demonstrated are asking users to select a problem type and then providing a guess for the problems. The three outputs demonstrated are outputting the problem, outputting the results from each guess, and outputting the final score at the end."


Row 2:

The response earned the point for this row, meeting all three criteria:

• Two distinct code segments are shown

• The name of the list is described as firstNumber

• The response states what values are stored in the list: "firstNumber stores the first number in the problem"


Row 3:

The response earned the point for this row, meeting both criteria: 

• The response includes the two lists firstNumber and secondNumber and are used in a loop to generate multiple problems

• The response explains how it manages complexity by stating "the list can store all the values in one variable and use a loop to create the problem." It also explains how the program would need to be written without a list by stating "Without list, the program would have to use individual variables and written sequentially instead of with a loop."


Row 4:

The response earned the point for this row, meeting both criteria: 

• The response includes two distinct code segments, one defining a function calculate with the type parameter and the other calling this function

• The response describes what the procedure does by stating "The function taking the type of questions as an input and then returning the number of correct answers back to the main program" and describes how it relates to the overall function by stating "The selected function contributes to the overall execution of the program by executing the quiz questions and returning how many questions were correct."


Row 5:

The response earned the point for this row, meeting both criteria: 

• The selected algorithm includes sequencing, selection (two if statements), and iteration (for loop for the problems)

• The response includes a detailed explanation of how to recreate the algorithm int he second paragraph of 3C.


Row 6:

The response earned the point for this row by meeting all three criteria:

• Two different calls are described, M and D. For each, the code segment that is executed is described. For example, "Inside the loop, the selection statement will execute the first part of the selection statement and print a problem with a * operator."

• For each call, the condition being tested is described. "The two test cases are based on passing a different input to create different types of problem in the function (multiplication versus division)."

• The result of each call is described in the response: "The result of the call will be to print 5 multiplication problems and return the number of correct answers."