What this deck covers
This deck focuses on Program Function And Purpose, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.
Study Program Function And Purpose in AP Computer Science Principles with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
Identify the error: def divide(a, b): return a/b; divide(5,0)
Tap card or press Space to flip
Division by zero error. Cannot divide by zero in mathematics.
How well did you know it?
Card 1 / 69
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on Program Function And Purpose, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: Division by zero error. Cannot divide by zero in mathematics.
Answer:
Answer: Replace x** with x**2. Exponentiation operator requires complete expression.
Answer: def. Standard Python keyword for function declaration.
Answer: A function defined without a name, often using lambda. Lambda creates functions without explicit naming.
Answer: Missing argument in increment(). Function call requires one argument but none provided.
Answer: To describe how the function works and its parameters. Documentation explains usage, parameters, and behavior.
Answer: A value passed to a function when it's called. Arguments are actual values sent to functions.
Answer: A method is a function that belongs to an object. Methods are functions bound to specific objects.
Answer: def. Standard Python keyword for function declaration.
Answer: Changes made by a function that affect outside state. Functions modify variables or system state externally.
Answer: Breaking down a program into separate functions. Organization strategy using independent, focused functions.
Answer:
Answer:
Answer: Replace x** with x**2. Exponentiation operator requires complete expression.
Answer: None. Empty function returns None by default.
Answer: Changes made by a function that affect outside state. Functions modify variables or system state externally.
Answer: Missing one argument in add(1). Function requires two parameters but only receives one.
Answer: Don't Repeat Yourself. Principle promoting code reusability and maintenance.
Answer: Division by zero error. Cannot divide by zero in mathematics.
Answer: A function that takes another function as an argument. Functions that operate on other functions.
Answer: A function with no side effects and consistent output. Pure functions have predictable, isolated behavior.
Answer:
Answer: y is undefined in multiply. Variable y is not defined in function scope.
Answer: To define where a variable can be accessed. Scope controls variable visibility and access.
Answer: Functions treated as first-class citizens, assignable to variables. Functions can be stored, passed, and manipulated.
Answer: A variable defined outside functions, accessible by all. Global variables exist throughout program execution.
Answer: To encapsulate reusable code logic. Functions group related code into reusable blocks.
Answer: To declare the function's signature before its definition. Prototypes declare function interface before implementation.
Answer: A variable defined within a function, accessible only there. Scope restricts access to function's internal area.
Answer: To explain code functionality for human readers. Comments improve code readability and maintenance.
Answer: -1. Function subtracts 1 from input 0.
Answer:
Answer: A method is a function that belongs to an object. Methods are functions bound to specific objects.
Answer: To explain code functionality for human readers. Comments improve code readability and maintenance.
Answer:
Answer: To provide a fallback value if no argument is passed. Defaults handle optional parameters gracefully.
Answer: A variable used to pass information into a function. Parameters act as placeholders for function inputs.
Answer:
Answer:
Answer: Breaking down a program into separate functions. Organization strategy using independent, focused functions.
Answer: The function's name and its parameter list. Identifies function uniquely by name and parameters.
Answer: A variable used to pass information into a function. Parameters act as placeholders for function inputs.
Answer: To declare the function's signature before its definition. Prototypes declare function interface before implementation.
Answer:
Answer: To define where a variable can be accessed. Scope controls variable visibility and access.
Answer: Defining multiple functions with the same name but different parameters. Same name functions with different parameter signatures.
Answer: None. Empty function returns None by default.
Answer: A function calling itself to solve a problem. Self-reference enables solving complex problems iteratively.
Answer: To send back a result from the function. Return transfers computed values back to caller.
Answer: To describe how the function works and its parameters. Documentation explains usage, parameters, and behavior.
Answer:
Answer: A value passed to a function when it's called. Arguments are actual values sent to functions.
Answer: A function calling itself to solve a problem. Self-reference enables solving complex problems iteratively.
Answer: y is undefined in multiply. Variable y is not defined in function scope.
Answer: Missing one argument in add(1). Function requires two parameters but only receives one.
Answer:
Answer: -1. Function subtracts 1 from input 0.
Answer: A variable defined outside functions, accessible by all. Global variables exist throughout program execution.
Answer:
Answer: To encapsulate reusable code logic. Functions group related code into reusable blocks.
Answer: To send back a result from the function. Return transfers computed values back to caller.
Answer: A function defined without a name, often using lambda. Lambda creates functions without explicit naming.
Answer:
Answer: The function's name and its parameter list. Identifies function uniquely by name and parameters.
Answer: A variable defined within a function, accessible only there. Scope restricts access to function's internal area.
Answer: Missing argument in increment(). Function call requires one argument but none provided.
Answer: To provide a fallback value if no argument is passed. Defaults handle optional parameters gracefully.
Answer: