0% found this document useful (0 votes)
1 views2 pages

APCSP Written Responses Compiled

The document contains practice exam responses for an APCSP written assessment, focusing on programming concepts related to filtering NFL team data. Key topics include the importance of documentation, iteration statements, testing strategies, and the modular design of filtering procedures. The responses highlight how to effectively filter and display team information while ensuring code efficiency and maintainability.

Uploaded by

williamgreer908
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

APCSP Written Responses Compiled

The document contains practice exam responses for an APCSP written assessment, focusing on programming concepts related to filtering NFL team data. Key topics include the importance of documentation, iteration statements, testing strategies, and the modular design of filtering procedures. The responses highlight how to effectively filter and display team information while ensuring code efficiency and maintainability.

Uploaded by

williamgreer908
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

APCSP Written Response Practice

Exams 1 to 3 - Sample Answers


Written Response Practice Exam 1
1. One piece of documentation that would be appropriate to include with or in the program is a
README file. This document is intended for users or other developers who need to understand
how to run or modify the program. It would include details such as how to use the interface,
descriptions of the filtering options, and how the program organizes and displays NFL team data.
A fellow developer could use the README to quickly grasp the program’s purpose, understand
the data structure, and identify where to make changes if needed.

2(a). The first iteration statement in the procedure is a for-loop:


for(var i=0; i < teamList.length; i++)
This loop executes as long as the index variable 'i' is less than the length of the teamList array.
Since 'i' starts at 0 and teamList has data, the loop will execute at least once if teamList is not
empty.

2(b). A sample call to the procedure could be: filter("Division", "AFC East"). This would cause the
program to filter all teams in the 'AFC East' division and display their respective information. The
function would return new filtered lists that are then displayed on the interface using
displayTeamInfo().

2(c). If the list (e.g., teamList) was not included in the code, the program would be unable to
retrieve, store, or iterate through the team data. To adjust the program, one would need to
hardcode each team’s data or use another method of data retrieval, such as manual user input
or a database. This would significantly reduce the efficiency and scalability of the program.

Written Response Practice Exam 2


1. Feedback and testing were important in the development of the program. For example,
testing different filter types and values helped ensure that the procedure correctly identified
and displayed the desired team information. Reflection on program outputs led to refining the
appendItems function to ensure the right data was added to each filtered list.

2(a). An equivalent Boolean expression for the conditional statement in the filter procedure
could be:
(filterType == "Team" && teamList[i] == filterValue)
This condition checks whether the current item in the teamList matches the provided filter value
when the filter type is "Team".
2(b). A strategy other than test cases to verify the correctness of the procedure would be code
tracing. This involves stepping through the code manually or using print statements (e.g.,
console.log) to monitor variable values and ensure that the correct branches of code are
executed based on different filterType and filterValue inputs.

2(c). The filter procedure solves the subproblem of extracting relevant team information based
on a specific filter. By isolating this logic, the procedure simplifies the main program flow and
allows modular handling of different filter types. This supports the overall goal of dynamically
displaying team data based on user selections.

Written Response Practice Exam 3


1. The program was created to help users learn more about NFL teams through an interactive
interface. Users can filter by team name, head coach, or division, and get details such as city,
stadium, and team logo. It serves as both an informative tool and a demonstration of filtering
and displaying structured data.

2(a). The code segment using the list is a for-loop that checks multiple conditions:
for(var i=0; i < teamList.length; i++) {
if(filterType == "Team" && teamList[i] == filterValue) {
appendItems(i);
}
}
This code iterates through teamList and compares each item to the filterValue. If the condition
matches, it calls appendItems(i), which adds the corresponding data from all related lists into
the filtered lists.

2(b). To test whether a specific block of code is executed based on arguments, output
statements like console.log("Team matched") can be inserted inside each conditional branch in
the filter procedure. For example, after 'if(filterType == "Team" && teamList[i] == filterValue)',
you could log to confirm it was executed. This confirms that passing different arguments results
in different branches of code executing.

2(c). If the 'filterType' parameter was removed from the filter procedure, the code would need
to be rewritten to only handle one specific type of filtering (e.g., only filter by team). This would
reduce the procedure’s flexibility and require multiple separate functions for each filter type,
making the program less efficient and harder to maintain.

You might also like