← AP CSP

Testing: AP CSP practice

Normal, boundary and erroneous data. 2 questions in the style of the AP CSP exam.

Sample questions

This is practice in the style of the end-of-course written response questions, which ask about code from your own Personalized Project Reference. Use the example program shown. Describe two calls to count_passing that would make the if statement behave differently. For each call give the arguments and the value returned.

scores = []
count = int(input())
for i in range(count):
    scores.append(int(input()))

def count_passing(score_list, pass_mark):
    passed = 0
    for s in score_list:
        if s >= pass_mark:
            passed = passed + 1
    return passed

mark = int(input())
print("Passed:", count_passing(scores, mark))