AP CSP Practice Exam Overview

Apr 3, 2026

All files

summarize_document

AP Computer Science Principles Create Performance Task Scoring Commentaries (2021 Rubrics)

This document provides scoring commentaries for the AP Computer Science Principles Create Performance Task, applying the 2021 rubrics to pilot student responses. It details how student projects were evaluated based on specific criteria, with examples from various student submissions.


Sample A: Language Translator (6/6 Points)

This response successfully earned full points by meeting all criteria across the evaluated sections.

  • Program Purpose and Functionality:

    • The program's purpose is to aid in learning new languages by translating color names.
    • Functionality demonstrated includes receiving user color selection in French and Spanish and outputting the audio pronunciation of the color in the selected language.
    • Input: User selects a language (Spanish or French) and taps on a color.
    • Output: Audio pronunciation of the color in the selected language.
  • Data Storage and Use (Lists):

    • Two code segments show data stored in a list named Audio and its use for processing output.
    • The Audio list stores color names in English, used to generate corresponding Spanish or French audio files.
    • Managing Complexity: The list Audio manages complexity by enabling the program to dynamically create audio filenames based on the selected language and color index. Without lists, each color-language combination would require individual buttons and more complex code.
  • Procedures and Algorithms:

    • A student-developed procedure ButtonClicked with a parameter index was used.
    • Purpose of ButtonClicked: Selects the correct audio file based on language and color selection, contributing to program efficiency by centralizing code.
    • Algorithm within ButtonClicked: Includes sequencing, selection (if statement), and iteration (while loop).
      • It takes the color's index, retrieves the English color name from the Audio list, appends a language identifier (e.g., '-spanish'), and adds '.mp3' to create the audio filename.
      • Iteration is used when no or both languages are selected, repeating an audio prompt.
    • Testing Procedures: Two calls to ButtonClicked were described: one for Spanish (color orange) and one for French (color orange), testing the correct translation output for each language.

Sample B: Typing Game (5/6 Points)

This response earned 5 out of 6 points, missing one criterion.

  • Program Purpose and Functionality:

    • Purpose: A computer game to practice typing skills.
    • Functionality: Users input phrases, earn points, and receive penalties for errors.
    • Input: Typing a sentence.
    • Output: Score updates, timer restarts upon correct input, or a penalty on the timer and a notification upon incorrect input.
  • Data Storage and Use (Lists):

    • Code segments show initialization and use of highScoreList to maintain top player scores.
    • highScoreList stores data from previous players.
    • Managing Complexity: highScoreList manages complexity by allowing easy sorting and resaving of high scores. Without it, managing an unknown number of variables for new high scores would be difficult.
  • Procedures and Algorithms:

    • The response did not earn the point for procedures and algorithms.
    • While a procedure ButtonClicked was mentioned, the scoring commentary focused on the first provided procedure (procedurerunclock in Sample E's context, though not explicitly detailed for Sample B's missing point).
    • The procedurerunclock (hypothetically, as it was not fully detailed for Sample B's missing point) included sequencing and selection but lacked iteration.
    • The explanation focused on proceduredisplayclock rather than the required procedure with a parameter.
    • No test cases for a procedure with parameters were provided.

Sample E: Screen Limiter (3/6 Points)

This response earned 3 out of 6 points.

  • Program Purpose and Functionality:

    • Purpose: To address screen addiction by making users conscious of their usage.
    • Functionality: Times screen usage, suggests alternative activities via an "activities button."
    • Input: Amount of time spent on screen daily.
    • Output: Screen-free challenge time, suggested activities.
  • Data Storage and Use (Lists):

    • Code segments show data stored in a list named activity and its use for suggesting activities.
    • activity stores alternatives to screen usage and screen-free challenge times.
    • Managing Complexity: The activity list organizes data in one location, avoiding the need for numerous buttons to display different activities.
  • Procedures and Algorithms:

    • The response did not earn points for procedures and algorithms.
    • The procedurerunclock procedure used a parameter time and was called by proceduredisplayclock.
    • However, the description of procedurerunclock was missing.
    • The procedurerunclock algorithm included sequencing and selection but lacked iteration.
    • The explanation focused on proceduredisplayclock, not procedurerunclock.
    • Test cases were related to other program aspects, not procedurerunclock.

Sample F: Darts Game (3/6 Points)

This response earned 3 out of 6 points.

  • Program Purpose and Functionality:

    • Purpose: To entertain children with multiple games.
    • Functionality: Gameplay involves entering a username, throwing darts, scoring, and displaying high scores.
    • Input: Username, dart throw location.
    • Output: Score per dart, high score list.
  • Data Storage and Use (Lists):

    • Code segments show data stored in Scores and HighScores lists, with HighScores using Scores to identify the top player.
    • Scores stores integer scores.
    • Managing Complexity: The response claimed Scores reduces lines of code by avoiding repeated display, but it did not adequately explain how the list manages complexity or how the program would be more complex without it. The provided code could achieve similar results with individual variables.
  • Procedures and Algorithms:

    • The response did not earn the point for procedures.
    • The backdrop_switches event was a built-in event, not a student-developed procedure with a parameter.
    • While the event's function was described (throwing a dart, scoring based on color), no procedure with a parameter was used.
    • The response did not earn the point for algorithms.
    • A student-developed algorithm was present, including sequencing, selection, and iteration (forever loop).
    • The explanation detailed how the algorithm works: throwing a dart randomly, scoring based on color, managing remaining darts, and assigning scores based on color contact.
    • The response did not earn the point for testing procedures.
    • The description provided paths based on user input during execution, not two distinct calls to a procedure with different arguments.

Sample G: RPG Character (2/6 Points)

This response earned 2 out of 6 points.

  • Program Purpose and Functionality:

    • Purpose: To simplify the creation of RPG characters with customizability.
    • Functionality: The video demonstrated collecting input for RPG character creation questions.
    • Input: Answers to character creation questions.
    • Output: Displayed RPG questions and prompts.
    • The response did not fully describe functionality or input/output.
  • Data Storage and Use (Lists):

    • Code segments show the stats list initialized and used in the StatRoll procedure.
    • stats stores player character attributes (Strength, Intelligence, etc.).
    • Managing Complexity: The stats list centralizes character attributes, making them easy to modify and export. Without it, each stat would be a separate variable, complicating management and export.
  • Procedures and Algorithms:

    • The response did not earn the point for procedures.
    • The code segment provided in 3c was not a student-developed procedure. The student-developed procedure with a parameter in 3b could not be used for scoring 3c.
    • The response earned the point for algorithms.
    • The hasSpaceInString procedure was student-developed, used a parameter str, and was called within code for saving a player's name.
    • Purpose of hasSpaceInString: Checks for spaces in a name using iteration, contributing to managing user input for score names.
    • The response earned the point for testing procedures.
    • Two calls to hasSpaceInString with different arguments ("Mr Guy", "Mr.Clean") were described, testing conditions for the presence or absence of a space and their resulting true/false outcomes.
    • The response did not earn the point for algorithms.
    • The hasSpaceInString algorithm included sequencing, selection, and iteration (for loop).
    • However, the explanation of the algorithm lacked sufficient detail for recreation.

Sample C: Global Warming (4/6 Points)

This response earned 4 out of 6 points.

  • Program Purpose and Functionality:

    • Purpose: To lessen global warming effects and reduce non-recyclable waste.
    • Functionality: Displays random "global questions," processes user answers, and provides feedback (statement, thumbs-up/down).
    • Input: User answers to questions via a textbox.
    • Output: Statements from "global solutions list," visual feedback (thumbs-up/down).
  • Data Storage and Use (Lists):

    • Code segments show initialization of solution_list and question_list, and their use in processing user responses.
    • question_list stores the questions displayed to the user.
    • The response did not earn the point for managing complexity.
    • The question_list was used to replace hard-coded question strings in if statements, but list access and processing were hard-coded by index, making it difficult to maintain and scale. The explanation of managing complexity was insufficient.
  • Procedures and Algorithms:

    • The response earned the point for procedures.
    • The interpret_response procedure used a parameter number_of_hours and was called by the Find_Response_button.Click event.
    • Purpose of interpret_response: Processes "number of hours" and selects an output from the solution_list based on the question and hours, using a loop to analyze the displayed question.
    • The response did not earn the point for algorithms.
    • The interpret_response algorithm included sequencing, selection, and iteration, but the iteration was trivial as the outcome was the same regardless of iteration count.
    • The explanation of the algorithm's sequence was provided, detailing how it checks the question and "number of hours" to select strings from the solutions_list and set an image property.
    • The response earned the point for testing procedures.
    • Two calls to interpret_response were described: one for AC usage ("6 hours") and one for driving time ("1 hour").
    • Conditions tested whether AC usage was too high or fossil fuel emissions were low.
    • Results described the appropriate user feedback and alternatives offered.

Sample D: Air Hockey (4/6 Points)

This response earned 4 out of 6 points.

  • Program Purpose and Functionality:

    • Purpose: To provide entertainment for solitary players.
    • Functionality: A digital air hockey game where users move paddles to score.
    • Input: Mouse location (x, y coordinates) to control paddles.
    • Output: Visible game interface, increasing score.
  • Data Storage and Use (Lists):

    • A code segment shows data stored in the scores list based on puck location.
    • scores stores the scores for the left and right players in its first and second indices.
    • The response did not earn the point for managing complexity.
    • The scores list did not manage complexity, as the same result could be achieved with two variables. The explanation that using variables would be more difficult was not substantiated.
  • Procedures and Algorithms:

    • The response earned the point for procedures.
    • The lpy procedure received a parameter y and was called.
    • Purpose of lpy: Limits the left paddle's movement to the left side of the screen by holding the mouse's y-intercept.
    • The response did not earn the point for algorithms.
    • The algorithm included sequencing and selection but lacked iteration.
    • The explanation of the algorithm was detailed enough for recreation.
    • The response earned the point for testing procedures.
    • Two calls to lpy were described based on the mouse's y-position relative to 40 and 50.
    • Conditions tested whether the y-position met requirements.
    • Results described whether the paddle would move or not based on the condition.
    • The response did not earn the point for algorithms.
    • An algorithm with sequencing, selection (if/elif), and iteration (while loop) was present but not within a procedure with a parameter.
    • The loop was trivial (controlled by looper1), and the explanation lacked sufficient detail for recreation.

Sample H: Water Safety (2/6 Points)

This response earned 2 out of 6 points.

  • Program Purpose and Functionality:

    • Purpose: To help users identify if their water is safe for drinking or animals.
    • Functionality: Identifies water safety.
    • Input: User input via prompted questions.
    • Output: Statements indicating water safety for drinking or animals.
  • Data Storage and Use (Lists):

    • Code segments showed data stored in a list named values and its use in processing responses.
    • The list was identified as values.
    • The response did not describe what was stored in the values list.
    • The response did not earn the point for managing complexity.
    • The values list held only one element, which could be stored in a single variable. The rationale provided did not demonstrate easier development, maintenance, or scaling.
  • Procedures and Algorithms:

    • The response did not earn the point for procedures.
    • A student-developed algorithm was present but not within a procedure with a parameter.
    • The description of the algorithm focused on adding user input to the list and testing nitrate levels, not on its detailed workings.
    • The response earned the point for algorithms.
    • The algorithm included sequencing, selection (try...except), and iteration (while loop).
    • The explanation detailed how the algorithm adds user input to a list and handles non-integer input.
    • The response did not earn the point for testing procedures.
    • No procedure with parameters was provided, and user inputs described were not shown as parameters to a procedure.

Sample I: Random Numbers (2/6 Points)

This response earned 2 out of 6 points.

  • Program Purpose and Functionality:

    • Purpose: To address the need for creating random numbers.
    • Functionality: Produces a series of random integers based on user input.
    • Input: An integer input.
    • Output: Displaying the series of values (though the description lacked detail on output demonstration).
  • Data Storage and Use (Lists):

    • A code segment shows data stored in a list named list and generated within a procedure.
    • list stores random integers.
    • The response did not earn the point for managing complexity.
    • The list was irrelevant; random values could be printed as generated. The explanation that lists make generating multiple numbers easier was not convincing.
  • Procedures and Algorithms:

    • The response earned the point for procedures.
    • The genlist procedure took a parameter n and was called.
    • Purpose of genlist: Consolidates random number generation into a function, returning a list of generated numbers.
    • The response did not earn the point for algorithms.
    • The algorithm included sequencing, selection (if n < 2), and iteration (for loop).
    • The description of what the algorithm does was provided, but not how it works for recreation.
    • The response did not earn the point for testing procedures.
    • Two calls to genlist with parameters 5 and 10 were described, resulting in lists of 5 and 10 random integers, respectively. However, these calls did not evoke different code segments within the algorithm as both parameters were greater than 1.



AP Computer Science Principles 2025 Free-Response Questions Summary

This document outlines the structure and content of the Free-Response Questions for the AP Computer Science Principles exam, specifically focusing on Set 2. These questions are designed to assess a student's understanding of their submitted Create Performance Task.

Exam Structure and Guidelines

  • Section II: This section consists of 2 questions, totaling 4 written-response prompts.
  • Time Allotment: Students have 60 minutes to complete Section II.
  • Basis of Questions: All questions are based on the student's Create Performance Task.
  • Personalized Project Reference: Students are instructed to refer to their Personalized Project Reference for specific code segments related to lists and procedures within their project.
  • Scratch Paper: Allowed for notes and planning, but only responses entered within the application will be graded.
  • Annotations: Text entered as annotations will not be considered part of the answer.
  • Navigation: Students can move between questions within this section until time expires.
  • Time Warning: The clock will turn red with 5 minutes remaining; no further verbal warnings will be given.
  • Format Note: The exam is presented in a format optimized for classroom use, though it was originally administered digitally.

Question Breakdown and Key Areas of Assessment

The Free-Response Questions (Set 2) assess various aspects of a student's Create Performance Task, focusing on:

Question 1: Program Output and Functionality

  • Task: Identify an example output of the student's program.
  • Assessment: Explain how this specific output demonstrates a particular aspect of the program's functionality.

Question 1 (Alternative Prompt): Unexpected/Invalid Input

  • Task: Identify an unexpected or invalid input a user might provide.
  • Assessment: Describe the program's behavior upon receiving this input. If the program is designed to prevent such inputs, explain why.

Question 2: Code Analysis and Modification (Referencing Personalized Project Reference)

This question is divided into three parts (A, B, and C), each focusing on different code elements:

  • Part A: Selection Statements and Boolean Expressions

    • Task: Identify the Boolean expression within the first selection statement in the Procedure section of the Personalized Project Reference.
    • Assessment:
      • Identify a specific value or set of values that will cause this expression to evaluate to true (or false in the alternative prompt).
      • Explain why the specified value(s) lead to that specific evaluation (true or false).
  • Part B: Procedures and Logic Errors

    • Task: Consider a specific procedure (identified in the Personalized Project Reference).
    • Assessment:
      • Describe a modification another programmer could make to this procedure that would introduce a logic error.
      • Explain how the procedure's behavior would change due to this logic error.
  • Part C: Lists and Code Modification

    • Task: Consider a specific list (identified in the List section of the Personalized Project Reference).
    • Assessment:
      • If new elements are added to the end of the list, explain how a related code segment (part (ii) of the List section) would need to be modified.
      • If no modifications are necessary, explain why.
  • Part C (Alternative Prompt): Procedures and Maintainability

    • Task: Consider a specific procedure (identified in the Personalized Project Reference).
    • Assessment:
      • Describe the functionality provided by this procedure.
      • Explain how implementing this functionality as a procedure makes the program easier to maintain compared to not using a procedure.



AP Computer Science Principles Practice Exam and Notes Summary

This document provides a practice exam and supplementary notes for the AP Computer Science Principles exam, developed by the College Board. It outlines the purpose, structure, and administration of the exam, as well as the College Board's commitment to equity and access in AP programs.

Main Idea

The primary purpose of this document is to serve as a preparation tool for the AP Computer Science Principles exam. It offers a practice exam that mirrors the format and content of the actual exam, along with detailed notes explaining the rationale behind each question and its alignment with the AP Computer Science Principles curriculum framework.

Key Points and Details

1. Purpose and Usage of the Practice Exam:

  • AP Exam Preparation: Provided by the College Board for students preparing for the AP Computer Science Principles exam.
  • Classroom Use Only: Teachers can download and copy materials for classroom use.
  • Security: All materials must be collected and kept secure after administration.
  • Restrictions: Exams cannot be posted online or redistributed electronically to maintain exam security and fairness. Violations may lead to termination of access and penalties.

2. About the College Board:

  • Mission-Driven Organization: Connects students to college success and opportunity.
  • Founded in 1900: Created to expand access to higher education.
  • Membership: Composed of over 6,000 leading educational institutions.
  • Services: Helps over seven million students transition to college through programs like SAT® and Advanced Placement (AP®).
  • Advocacy: Supports students, educators, and schools through research and advocacy.
  • Website: www.collegeboard.org

3. AP® Equity and Access Policy:

  • Encourages Equitable Access: All willing and academically prepared students should have the opportunity to participate in AP.
  • Eliminate Barriers: Efforts should be made to remove barriers for underrepresented ethnic, racial, and socioeconomic groups.
  • Diverse Classes: AP classes should reflect the diversity of the student population.
  • Preparation: All students should have access to academically challenging coursework before AP classes to prepare them for success.

4. Exam Content and Format:

  • Exam Structure: The AP Computer Science Principles assessment has two parts:
    • Through-Course Assessment (40% of score): Consists of two performance tasks requiring digital artifact uploads via a web portal.
    • End-of-Course Exam (60% of score): Consists of 74 multiple-choice questions. This practice exam is for the end-of-course exam only.
  • Exam Length: 2 hours.
  • Question Types:
    • Single-select multiple-choice questions (select one answer).
    • Multiple-select multiple-choice questions (select two answers).
  • Stimulus Material: Questions may be accompanied by non-textual materials like diagrams or charts.
  • Programming Reference: Programming reference materials are included in the exam booklet to help understand programming question formats and meanings, as no specific programming language is designated.

5. Development of AP Courses and Exams:

  • Committee Design: Courses and exams are designed by committees of college faculty and AP teachers.
  • Curriculum Framework: Committees define course scope, expectations, and learning objectives.
  • Evidence-Centered Design: Exams are developed using an evidence-centered design approach, starting with end goals and defining observable performance evidence.
  • Backward Design: Curricula, instruction, and assessments are developed with the end goal in mind.
  • Multiyear Process: Exam development is a multiyear process involving extensive review, revision, piloting, and analysis.
  • Feedback: Feedback from secondary and postsecondary educators is gathered throughout the development process.

6. Scoring of AP Exams:

  • Multiple-Choice: Scored by machine.
  • Performance Assessments: Scored by college faculty and expert AP teachers at the AP Reading.
  • Scoring Process: Readers are trained, and their work is monitored for fairness and consistency. A Chief Reader oversees scoring standards.
  • Composite Score: Weighted scores from multiple-choice and performance assessments are combined into a composite score, converted to an AP score of 1-5.
  • Score Setting: Involves psychometric analyses and comparison with college-level standards. AP scores are generally equivalent to college grades (e.g., AP score of 5 is equivalent to an A in a comparable college course).

7. Administering the Practice Exam:

  • Instructions: Detailed instructions are provided for administering the practice exam to simulate actual testing conditions.
  • Time Limit: 2 hours for 74 multiple-choice questions.
  • Scoring: Total score is based only on the number of questions answered correctly; no points are deducted for incorrect answers or unanswered questions.
  • Reference Materials: Students should use the provided programming reference materials.

8. Programming Reference Materials:

  • Data Types: Instructions use four data types: numbers, Booleans, strings, and lists.
  • Categories of Instructions:
    • Assignment, Display, and Input
    • Arithmetic Operators and Numeric Procedures (including MOD and RANDOM)
    • Relational and Boolean Operators (=, ≠, >, <, ≥, ≤, AND, OR, NOT)
    • Conditional Execution (IF, IF/ELSE)
    • Iteration (REPEAT, REPEAT UNTIL, FOR EACH)
    • List Operations (accessing elements, assignment, INSERT, APPEND, REMOVE, LENGTH)
    • Procedures (with or without RETURN values)
    • Robot Commands (MOVE FORWARD, ROTATE LEFT, ROTATE RIGHT, CAN MOVE)

9. Notes on the Practice Exam:

  • Curriculum Framework Alignment: This section explains how each practice question links to the AP Computer Science Principles curriculum framework (Enduring Understandings, Computational Thinking Practices, Essential Knowledge).
  • Rationales: Provides explanations for correct and incorrect answer choices.

This practice exam and its accompanying notes are designed to provide a comprehensive and accurate representation of the AP Computer Science Principles exam, aiding both educators and students in their preparation.




Summary of Word Guessing Game Program

This document describes a word guessing game created on the code.org website, designed to help users recognize new words and expand their vocabulary. The game involves a user guessing letters to reveal a randomly generated word, with a limited number of lives.

Core Functionality

The game's primary function is to compare user input (letters) against a hidden word.

  • guessWords(letter) Function: This is the core logic for handling user guesses.

    • It initializes a boolean variable check to false and a counter count to 0.
    • It iterates through the individual letters of the guessingWord (stored in the letOfGuessWord list).
    • Letter Matching: If the letter input by the user matches a letter in letOfGuessWord, the following occurs:
      • The matched letter is displayed in its correct position on the screen (e.g., setText("let" + i, letter)).
      • check is set to true.
      • count is incremented to track correct guesses.
    • Incorrect Guess Handling: After checking all letters, if check remains false (meaning the guessed letter was not in the word):
      • A life is deducted from the user (lives = lives - 1).
      • The displayed lives count is updated (setText("livesCount", lives)).
    • Game End Conditions:
      • Losing: If lives reaches 0, the game ends, and the "losingScreen" is displayed, showing the correct word.
      • Winning: If count equals the length of the guessingWord, all letters have been guessed correctly, and the "winningScreen" is displayed.
    • The function returns the check boolean, indicating if the guessed letter was found.
  • onEvent("textInp", "change", ...): This event handler is triggered when the user types into the input field (textInp).

    • It retrieves the user's input.
    • It converts the input to lowercase using .toLowerCase().
    • It calls the guessWords() function with the processed input.
    • It clears the input field (setText("textInp", "")).

Data Structures and Initialization

  • getRandomWord() Function:
    • Initializes the lives display.
    • Filters allWords to create a list words5 containing only words of length 5.
    • Selects a random word from words5 to be the guessingWord.
    • letOfGuessWord List: This crucial list stores each individual letter of the guessingWord in separate indexes.
      • This is vital for efficient comparison and display of letters. Without it, the program would need multiple variables and more complex loops.

Game Variables

  • lives: Initialized to 6, representing the number of attempts the user has.
  • count: Initialized to 0, tracks the number of correctly guessed letters.
  • check: A boolean flag, initialized to false for each guess, indicating if a correct letter was found in the current guess.

Example Scenarios (Test Cases)

The document provides specific examples to illustrate the guessWords function's behavior:

  • First Call Example:

    • User Input: 1
    • Guessing Word: "hello"
    • Condition Tested (Line 49): The if statement compares "1" to each letter in "hello".
    • Result: false, because "1" is not found in "hello".
  • Second Call Example:

    • User Input: "h"
    • Guessing Word: "hello"
    • Condition Tested (Line 49): The if statement compares "h" to each letter in "hello".
    • Result: true, because "h" is found in "hello".

Observed Game Behavior (from Video Description)

The accompanying video demonstrates various aspects of the game:

  • Users input letters, numbers, symbols, and multiple characters.
  • Correct guesses reveal the letter in its position (e.g., P input results in p_ _).
  • Incorrect guesses lead to a loss of a life.
  • The game concludes with either a winning screen (all letters guessed) or a losing screen (ran out of lives).



Summary of the Fishing Game Program

This document outlines the functionality and mechanics of a simulated fishing game, focusing on its core purpose, player input, game elements, and the procedural logic for fish movement.

1. Overall Program Purpose and Gameplay

  • Objective: To reduce boredom by simulating a timed fishing game that includes scorekeeping.
  • Demonstrated Features:
    • Boat movement controlled by player input.
    • Hook mechanics: The hook moves down from the boat and returns to catch fish.
    • Scorekeeping: Tracks the total score based on fish caught within the time limit.
    • Detailed Scorekeeping: Tracks the quantity of each specific type of fish caught.

2. Player Input and Game Output

  • Boat Movement:
    • Input: Pressing the 'a' key moves the boat left.
    • Input: Pressing the 'd' key moves the boat right.
  • Hook Action:
    • Input: Pressing the spacebar initiates the hook action.
    • Output: A hook sprite moves downwards from beneath the boat and then returns. This action is designed to "catch" or touch other sprites (fish).
  • End Game Output:
    • When the time limit is reached, the game displays a message detailing:
      • The amounts of each type of fish caught.
      • The total score.

3. Data Management: The fishtypes List

  • Purpose: The fishtypes list is crucial for tracking the quantity of fish caught.
  • Functionality:
    • It stores data representing the type of fish and the number of that specific fish caught.
    • Manages Complexity: By consolidating all fish data into a single list, it avoids the need for numerous individual variables for each fish type and its count, making the code more concise and manageable.
    • Extensibility: Allows for easy addition of new fish types by simply adding their data to the existing list.

4. Clone Movement Procedure (clone movement)

  • Role: This procedure dictates the behavior of the fish sprites (clones). It determines where a clone spawns, its movement range, and how it behaves when it reaches the edge of the screen.
  • Contribution to Gameplay: It enhances the challenge by making fish clones spawn and move randomly, with varying speeds and heights, making them harder to catch with the hook.

4.1. Clone Initialization and Movement Logic

  • Initial Spawn:
    • A newly spawned clone is positioned at a random X-coordinate on the screen.
    • Its height is set randomly within a range defined by the y1 and y2 parameters.
  • Movement Loop:
    • The clone continuously moves until either the game ends or it collides with the hook.
  • Edge Detection and Response (If-Else Statement):
    • Condition 1: Touching the Right Edge:
      • Test: If the clone sprite touches the right edge of the screen.
      • Action (First Call): The clone teleports to the left.
        • The X-position is set to a value specified by the rt state (return state) parameter.
        • The Y-position is set randomly within the y1 to y2 range.
        • Result: This ensures the clone continues moving without exiting the screen.
    • Condition 2: Not Touching the Right Edge:
      • Test: If the clone sprite is not touching the right edge of the screen.
      • Action (Second Call): The clone moves to the right.
        • It moves a random number of steps within the range specified by the s1 and s2 parameters.
        • Result: The clone moves horizontally across the screen.

4.2. Procedure Calls and Conditions

  • First Call (Returning Call):
    • Action: go to x:(rt state) y: [pick random(y1) to (y2)]
    • Condition Tested: Whether the clone sprite is touching the edge of the right side of the screen.
  • Second Call (Normal Movement):
    • Action: change x by [pick random(s1) to (s2)]
    • Condition Tested: Whether the clone sprite is not touching the edge of the right side.



Interactive Conway's Game of Life Simulation

This document describes an interactive program that simulates John Conway's Game of Life, designed for user entertainment. The program allows users to manipulate a grid of cells and observe their evolution according to the game's rules.

Core Functionality

  • Interactive Grid Manipulation: Users can place and remove cells on a grid using mouse clicks and position.
  • Conway's Game of Life Rules: The simulation progresses programmatically based on the established rules of Conway's Game of Life.
  • Generation Updates: The screen updates after each generation to reflect the changes in cell states.
  • Simulation Controls: Users can pause (p), restart (space), and reset (r) the simulation at any time, allowing for editing and replaying.

User Input and Output

  • Inputs:
    • Keyboard keys: space (pause/resume), p (pause), r (reset).
    • Mouse: Clicks and position for placing/removing cells.
  • Outputs:
    • Visual representation of the grid with placed or removed cells.
    • Progression of cells through simulated generations.
    • Updates to the simulation state (paused, reset, cleared).

Cell Placement and Management

  • A function checks for existing cells at the current mouse position to allow for placement or removal before the simulation begins.
  • The X and Y coordinates of the mouse are used to determine the corresponding cell's location within the data structure.
  • Code stores the type of cell last clicked, enabling continuous placement or removal by holding down the mouse button.

Game of Life Rules Implementation

The simulation checks the state of surrounding cells for each cell on the grid.

  • Survival: A live cell with two or three live neighbors remains alive.
  • Death: A live cell with fewer than two or more than three live neighbors dies.
  • Birth: A dead cell with exactly three live neighbors becomes a live cell.

Data Structures and Management

  • Lists: Three primary lists are used: startGrid, currentGrid, and nextGrid. These are maintained to allow for recalling previous states even after edits.
    • startGrid and currentGrid are often identical, with currentGrid being a copy of startGrid initially.
  • Cell Representation: Each item in these lists represents a single cell on the grid.
    • The grid size is 10,800 cells (120x90).
    • A value of 0 indicates a dead cell, and 1 indicates a live cell.
  • Coordinate Mapping: The position of an item in the list directly corresponds to a cell's coordinates on the grid, and vice versa. This list-based approach is chosen for efficiency and ease of management compared to individual variables.

Simulation Progression (Tick/Generation)

The program progresses the simulation one tick (generation) at a time through a dedicated function.

  1. Data Copying: All cell data from the currentGrid is copied to the nextGrid.
  2. Neighbor Check: The surroundings of all cells are checked, and the results are recorded for the nextGrid.
  3. State Update: The nextGrid then replaces the currentGrid, effectively advancing the simulation to the next generation.

List Copying Mechanism (genSwap)

A procedure handles copying data between lists, taking identifying numbers for two lists as input: the source and the destination.

  • Purpose: Used to store cell states for a generation, replace one list with another, and recall previous states by copying lists, enabling duplication and saving of grid positions.
  • Algorithm:
    • Uses nested if-else statements to determine which list to copy from and to, based on the input parameters (0, 1, or 2 representing the three lists).
    • The destination list is cleared before copying to ensure correct item count.
    • A loop iterates through the source list, copying each item to the corresponding position in the destination list.
  • Calls:
    • Reset Function: Called with parameters 0, 1 (copying startGrid to currentGrid) during program initialization or when the user resets.
    • Main Generation Function: Called with parameters 2, 1 (copying nextGrid to currentGrid) after calculating the next generation's state.

Reset Functionality

  • A simple reset function clears all lists and replaces their contents with placeholder values, effectively returning the simulation to its initial state.



Summary of Poem Generation Program

This document describes a program designed to generate unique poems based on user input for words and formatting preferences, specifically the inclusion or exclusion of articles.

Program Objective and Functionality

  • Goal: To explore user creativity by generating unique poems using their chosen words and formatting preferences.
  • User Input: Users provide words (nouns, verbs, adverbs) and specify preferences for including articles ("yes" or "no") and the number of poems to generate.
  • Output: The program generates a specified number of poems based on the user's input words and article preference.

Core Components and Procedures

  1. Word Input and Storage:

    • Users are prompted to enter nouns related to specific themes (e.g., trees, ocean, night sky).
    • These nouns are stored in a list (e.g., nounList).
  2. selectWord Procedure:

    • This procedure is responsible for randomly selecting a word from a given list.
    • It uses the random.randint function to pick a random index and then pops the word from the list, ensuring each word is used only once per poem generation cycle.
    • Using lists for word storage simplifies random selection and management of multiple words compared to individual variables.
  3. createPoems Procedure:

    • This is the main procedure for assembling the final poems.
    • It takes lists of words (nouns, verbs, adverbs) and an aSetting parameter (1 for articles, 0 for no articles) as input.
    • It relies on other, unpictured procedures: articlePoem (for poems with articles) and noArticlePoem (for poems without articles).
    • Logic:
      • Initializes a poem counter and an empty string for the final poems.
      • Iterates to generate the user-specified number of poems.
      • Inside the loop, it uses if statements based on aSetting to call either articlePoem or noArticlePoem.
      • The generated poem is appended to the final string.
      • Finally, it returns the compiled string of poems.

Poem Generation Calls and Conditions

The program demonstrates two distinct calls to the createPoems procedure, differentiated by the aSetting parameter, which is determined by the user's articlePreference.

  1. First Call (with articles):

    • Code: print("In" + createPoems(nounList, verbList, adverbList, 1))
    • aSetting Value: 1
    • Condition Tested: The if aSetting == 1: condition on line 37 is met.
    • Result: The articlePoem procedure is called, and the generated poems will include articles like "The" and "And".
  2. Second Call (without articles):

    • Code: print("In" + createPoems(nounList, verbList, adverbList, 0))
    • aSetting Value: 0
    • Condition Tested: The if aSetting == 1: condition on line 37 fails. The code proceeds to the if aSetting == 0: condition on line 39, which is met.
    • Result: The noArticlePoem procedure is called, and the generated poems will not include articles like "The" and "And".

Example Scenario

The text describes a demonstration where:

  • Initially, words like "pine," "star," and "lies" are used with articles, generating 3 poems.
  • Subsequently, different words like "forest," "expanse," and "glows" are used without articles, generating 5 poems.

This illustrates how user inputs for words, article preference, and the desired number of poems directly influence the final output.




AP Computer Science Principles Practice Exam Summary

This document contains a practice exam for AP Computer Science Principles, covering a wide range of topics related to algorithms, data representation, the Internet, cybersecurity, and programming. The exam is designed to assess students' understanding of computational thinking practices and essential knowledge statements from the AP Computer Science Principles curriculum framework.


Section 1: Algorithms and Programming

  • Program Comparison (Question 15): Compares the output of two programs, focusing on the values displayed, their order, and the number of values.
  • Procedure Max (Question 21): Evaluates expressions using a Max procedure to find the greatest of three integer values.
  • Robot Movement Procedures (Questions 22, 27, 34): Involves understanding and predicting the movement of a robot on a grid based on provided procedures and code segments.
  • IsHot Procedure (Question 23): Requires completing a procedure that determines if a majority of daily high temperatures in a month meet a certain threshold (>= 90 degrees).
  • Guessing Game Debugging (Question 30): Identifies where to insert a win <- true instruction to ensure a guessing game loop terminates correctly.
  • Prime Number Counting (Question 135): Requires identifying and removing incorrect lines of code from a program intended to count prime numbers in a list.
  • String Manipulation (Question 64): Uses Concat and Substring procedures to generate a specific target string.
  • Frequent Customer Program (Question 43): Implements a logic to set a cost to 0 for every 10th purchase using the MOD operator.
  • Calculating Average (Question 42): Compares two code segments for calculating the average of a list, analyzing their correctness and efficiency.
  • Procedure Multiply Error Analysis (Question 137): Identifies conditions under which a procedure intended to multiply integers using repeated addition will not return the correct product.
  • Procedure Smallest Error Analysis (Question 138): Identifies lists for which a procedure intended to find the smallest value in a list will not return the correct result.
  • Procedure KeepPlaying Logic Error (Question 60): Analyzes a procedure that incorrectly determines user input for continuing a game.
  • Sum of Integers (Question 62): Determines the result of a program that calculates the sum of a specific range of integers.
  • GetCount and MOD Operator (Question 43): Implements logic for a frequent customer program using the modulo operator.
  • Max Procedure for Grade Calculation (Question 46): Uses the Max procedure to calculate a student's adjusted total points based on midterm and final exam scores.
  • Power Procedure Generalization (Question 59): Identifies a generalized procedure that encompasses Square and Cube procedures.
  • IsPalindrome Algorithm (Question 57): Determines the correct order of steps (sort, filter palindromes, extract first letter) to implement an algorithm.

Section 2: Data Representation and Abstraction

  • Minimum Bits for Characters (Question 31): Calculates the minimum number of bits required to represent a given number of unique characters.
  • Hexadecimal Color Representation (Question 35): Identifies the hexadecimal number representing the color with the greatest amount of blue.
  • Byte Pair Encoding (Questions 25-26): Explains byte pair encoding as a lossless transformation and identifies strings where it cannot shorten the length.
  • Metadata in E-books (Question 20): Determines what is LEAST likely to be contained in the metadata of an e-book.
  • Representing Data with Bits (Question 49): Analyzes potential overflow errors when using a fixed number of bits (4 bits) to represent non-negative integers.
  • Hexadecimal vs. Binary Representation (Question 61): Discusses the benefits of using hexadecimal numbers over binary numbers for data representation.
  • Abstraction in Programming (Question 132): Identifies ways programmers use abstraction to manage program complexity (e.g., procedures, data structures).
  • Data Representation Trade-offs (Question 41): Explains the result of a floating-point representation error.

Section 3: The Internet and Networking

  • Internet Communication Requirements (Question 16): States that every device connected to the Internet is assigned an Internet Protocol (IP) address.
  • Domain Name System (DNS) (Question 28): Explains the purpose of DNS in translating domain names to IP addresses.
  • Network Configurations and Redundancy (Question 24): Identifies a network configuration where redundant routing between two computers is not possible.
  • Open Standards and Protocols (Question 44): Explains the benefit of open standards and protocols for enabling interoperability on the Internet.
  • Internet Protocol Versions (IPv4 vs. IPv6) (Question 47): Describes the result of using 128-bit addresses instead of 32-bit addresses in terms of the number of available addresses.
  • Distributed Denial-of-Service (DDoS) Attacks (Question 63): Explains how a DDoS attack can compromise a website.
  • Web Page Hierarchy (Question 131): Describes the relationship between example.org and about.example.org in terms of domains and subdomains.
  • Cloud Computing's Impact (Question 136): Identifies how cloud computing has affected Internet communication (enhancing collaboration, introducing security concerns).
  • Latency Measurement (Question 39): Identifies the appropriate unit for measuring network connection latency (milliseconds).

Section 4: Cybersecurity and Data Security

  • Phishing Attempt Analysis (Question 2): Identifies the privacy risk associated with responding to a suspected phishing email.
  • Public Key Cryptography (Question 52): Explains what is needed to decrypt a message encrypted with a recipient's public key (the recipient's private key).
  • Symmetric Encryption (Question 56): Provides an example of symmetric encryption.
  • Digital Certificates (Question 16): Clarifies the role of digital certificates in Internet communication.

Section 5: Societal and Ethical Impacts of Computing

  • Digital Divide (Question 18): Identifies actions that can help reduce the digital divide (education, device access, infrastructure).
  • Copyright and Music Sampling (Question 40): Suggests using samples published with a no-rights-reserved Creative Commons license to minimize copyright violation risk.
  • Crowdsourcing and the Internet (Question 65): Explains how the Internet enables crowdsourcing (access to tools, information, lowering geographic barriers).
  • Online Encyclopedias vs. Traditional (Question 134): Discusses advantages of online encyclopedias (larger number of perspectives, quick updates).
  • Data Privacy and User Actions (Question 17): Identifies the LEAST likely consequence of downloading an album from a licensed seller.

Section 6: Models, Simulations, and Data Analysis

  • Model Accuracy for Birth Prediction (Question 19): Determines the strategy LEAST likely to improve the accuracy of a birth prediction model.
  • Moore's Law Assumption (Question 29): Identifies the underlying assumption of Moore's Law (computing power increases over time).
  • Machine Learning Purpose (Question 58): Describes the purpose of machine learning programs (recognizing patterns, making predictions).
  • Data Analysis from Survey (Question 36): Forms a hypothesis consistent with data presented in a scatter plot relating reading hours, smartphone usage, and interest in an app.
  • Video Streaming Analysis Time (Question 33): Approximates the execution time of a program involving multiple calls to a time-consuming procedure.
  • Mouse Population Simulation (Question 38): Identifies an assumption made in a mouse population simulation program (predator population remains constant).
  • Photo Data Analysis (Question 9): Determines what information can be derived from photo metadata (location, time).
  • Mice Population Simulation Assumption (Question 38): Identifies an assumption made in a simulation about predator population stability.
  • Data Sets from Different Schools (Question 133): Determines what can be done with combined data from two schools with different data formats.
  • Video Archival (Question 66): Identifies the action LEAST likely to support the goal of saving full-quality digital video files for archival.

Section 7: Logic Gates and Circuits

  • Logic Gate Circuit Output (Question 32): Determines the input values that will result in a specific output (false) from a given logic gate circuit.
  • NAND Gate Boolean Expression (Question 50): Models a NAND gate using a Boolean expression.

Section 8: Number Representation and Errors

  • Floating-Point Representation (Question 41): Explains why a calculation results in a repeating decimal due to floating-point precision limits.
  • Integer Representation and Overflow (Question 49): Identifies operations that will result in an overflow error when using 4 bits for non-negative integers.

Section 9: Internet Protocols and Services

  • Internet Communication Standards (Question 16): States that devices need an IP address to communicate on the Internet.
  • Domain Name System (DNS) (Question 28): Explains the function of DNS.
  • Internet Engineering Task Force (IETF) (Question 6): Describes the role of the IETF in developing Internet standards.
  • Cloud Computing and Internet Communication (Question 136): Discusses the impact of cloud computing on Internet communication.

Section 10: Computational Problem Solving

  • Undecidable Problems (Question 51): Explains that it is not possible to create an algorithm that solves the halting problem for all programs and inputs.
  • Algorithm Efficiency (Question 48): Characterizes an algorithm's performance for large inputs based on a table of steps.

Section 11: Multiple-Select Questions (Two Correct Answers Required)

  • Cloud Computing Impact (Question 136): Selects two statements describing the effects of cloud computing on Internet communication.
  • Abstraction in Programming (Question 132): Selects two methods programmers use to manage program complexity through abstraction.
  • Online Encyclopedia Advantages (Question 134): Selects two advantages of an online encyclopedia over a traditional paper-based one.
  • Prime Number Program Correction (Question 135): Identifies two lines of code to be removed to correct a prime number counting program.
  • Web Page Hierarchy (Question 131): Selects two accurate statements about the hierarchy of web pages.
  • Crowdsourcing and the Internet (Question 65): Selects two true statements about how the Internet enables crowdsourcing.
  • Procedure Multiply Error Conditions (Question 137): Selects two conditions under which the Multiply procedure will not return the correct product.
  • Procedure Smallest Error Lists (Question 138): Selects two lists for which the Smallest procedure will not return the intended value.
叫我ap master,这里有8套AP科目真题,我今年要考了,很焦虑,帮我统计一下高频知识点,对应核心terms,中英输出,table展现

好的,ap master!以下是基于你上传的8套AP Computer Science Principles(CSP)真题、样题和评论文件内容,为你整理的高频知识点及核心terms。为便于理解,我按照【知识点分类】【核心术语】【英文】【中文解释】双语表格形式给出,助你临考系统复习。


AP Computer Science Principles 高频知识点&核心术语对照表

| 知识点分类 | 英文核心Term | 中文术语/释义 | 额外说明(考查亮点、命题角度) | |----------------------|-------------------------|-------------------------------------|---------------------| | Algorithms | Algorithm | 算法 | 流程步骤、效率、可实现性,顺序结构/选择/循环结构等 | | | Procedure/Function | 程序/函数/过程 | 带/不带参数,有无返回值,自定义功能模块 | | | Boolean Expression | 布尔表达式/逻辑表达式 | 条件判断,true/false | | | Selection Statement | 选择语句 | if-else结构 | | | Iteration/Loop | 循环结构 | for/repeat/do while | | Data & Abstraction | List/Array | 列表/数组 | 管理复杂数据、更高效遍历/查找 | | | Abstraction | 抽象 | 管理复杂性、简化代码 | | | High-level Language | 高级编程语言 | 易读性&抽象性(和低级语言对比) | | Modeling & Simulation| Simulation/Model | 模拟/建模 | 用程序模拟真实现象找结论,抽象与实践结合 | | Data Analysis | Data Storage/Variable | 数据存储结构/变量 | 数据类型识别与区分:数字、字符串、布尔值 | | | Metadata | 元数据 | 附加信息(如图片、文件附带时间地点等) | | | Pattern Recognition | 模式识别 | 发现规律找趋势,用于算法优化 | | System/Architecture | Internet Protocol(IP) | 网络协议/IP地址 | IP地址、包分片与重组、IPv4/IPv6 | | | Open Standards/Protocol | 开放标准/协议 | 不同厂家设备互通关键 | | | DNS (Domain Name System)| 域名系统 | 域名与IP地址映射 | | Security | Encryption | 加密 | 对称加密/非对称加密;公钥/私钥;传输安全认证 | | | Phishing | 网络钓鱼 | 通常考场景判断与防护方法 | | | Digital Certificate | 数字证书 | 网站真实身份认证 | | Social Impact | Crowdsourcing | 众包 | 利用互联网聚集智慧 | | | Digital Divide | 数字鸿沟 | 技术普及、教育机会不均等问题 | | | Copyright/Creative Commons | 版权/创作共用协议 | 网络素材合法性 | | | Collaboration | 协作 | 小组合作、协同开发、在线共享 | | | Cloud Computing | 云计算 | 数据存储、远程协作、隐私安全 |


高频知识点详细说明举例(部分)


重点背诵建议

  • 熟记术语的英文与权威定义,能结合代码和实际场景简明扼要解释其作用;
  • 算法题注意if/else的条件分支、list操作、循环变量变化(可用流程图辅助理解);
  • 互联网协议、加密技术简答题要会结合图示准确描述流程;
  • 社会影响题重在分析“创新”“协作”“公平”等多角度,例题常用你身边的实际事例来解释。

祝你AP考试一切顺利,ap master!如需某一知识点精讲/练习/习题解析,随时召唤我!

数据结构知识点我没学好,可以给我具体讲讲,配上真题教教我

ap master,你问的“数据结构”在AP CS Principles中核心是理解和应用“列表(list, array)”“元数据(metadata)”“变量(variable)”“抽象(abstraction)”等知识点,不侧重考花哨的数据结构算法,而是实际如何用这些工具“简化、管理和处理复杂数据”。以下用真题例子和讲解,帮你一步步搞懂。


高频数据结构知识点

| 英文名称 | 中文术语 | 释义/理解 | 典型真题/考查角度 | |---------------|------------------|----------------------------------------------------------|------------------------------------------------| | List/Array | 列表/数组 | 一组有顺序的数据,可以用下标访问、修改、遍历等 | 例题涉及用list存储多个变量、优化复杂度[7][45][49]等 | | Variable | 变量 | 临时存储单个数据值 | 用于存储状态、临时结果 | | Metadata | 元数据 | 描述数据的数据,比如图片的拍摄时间、文件大小、类型等 | 考查“元数据能/不能”推断什么,其与数据本体的区别[10] | | Data Abstraction | 数据抽象 | 用能代表一组数据的方式简化操作,最常见为列表/字典/常量等 | 用抽象“管理复杂度”,提高可维护性[7][12][13] |


知识点详解+真题举例

1. 列表(List/Array)

概念

  • 列表是一串有序元素集合。每个元素有下标(index),通常从1或0开始。
  • 常见操作:添加、删除、访问(list[i])、遍历(for)、求长度等。

为什么用列表?

  • 一组值用一个list变量替代多个变量,减少代码复杂性、提高拓展性。
  • 例:存储10个分数用list比10个score1、score2...方便。

真题例子

例题&解析

  1. 管理复杂性(抽象)

    Which of the following are ways in which a programmer can use abstraction to manage the complexity of a program? (选A和D) A. Replacing each instance of repeated code with a call to a procedure
    D. Replacing string variables name1, name2...name4 with a list names

  2. 真实案例拆解(创造任务)

  3. 数据抽象性能(代码段提升)


2. 变量(Variable)

概念

  • 一个变量只能存储一个值,如果有多组相关数据建议用列表处理

真题考点:


3. 元数据(Metadata)

概念

  • 元数据是“数据的属性描述”
  • 在AP CSP中,常见元数据如:文件的时间戳、类型、大小、拍摄设备等

真题考查


4. 抽象(Abstraction)

概念

  • 用更高级的方式简化底层细节,list是典型的数据抽象实例
  • 好的抽象使得程序可扩展、易读、易维护

真题考点


真题技巧总结


核心词汇&术语中英对照表

| 英文术语 | 中文对照 | 学习场景说明 | |---------------|------------------|------------------------------------------| | List/Array | 列表/数组 | 数据集,如各个分数、颜色、物品名称 | | Abstract | 抽象 | 管理复杂性,统一处理,代码简洁 | | Variable | 变量 | 存单一值,如”分数“、”临时结果“ | | Metadata | 元数据 | 文件属性、数据描述 | | Index | 下标/索引 | 列表中的第几个元素(从0或1开始) | | Item/Element | 元素/成员 | 列表里的每一项 | | Traverse | 遍历 | 通常用for循环访问列表里的每个元素 |


拓展练习:自查

  • 请用list写一个保存班里所有成绩的简单例子,并实现求平均分。
  • 思考:如果后续班里人数增加或者减少,为什么用list方便?
  • 请说说元数据和普通数据的区别,各举一例。

有问题就问我,ap master!考前看不明白也可以把题目截图直接甩给我详细讲解。

Ask Sia for quick explanations, examples, and study support.