Program Design and Development - AP Computer Science Principles
Card 1 of 30
What is encapsulation in object-oriented programming?
What is encapsulation in object-oriented programming?
Tap to reveal answer
Bundling data with methods that operate on the data. Data hiding principle combining related data and functions together.
Bundling data with methods that operate on the data. Data hiding principle combining related data and functions together.
← Didn't Know|Knew It →
Identify the error: 'if (x = 10)'
Identify the error: 'if (x = 10)'
Tap to reveal answer
Correct: 'if (x == 10)'. Single '=' assigns value; '==' compares for equality in conditions.
Correct: 'if (x == 10)'. Single '=' assigns value; '==' compares for equality in conditions.
← Didn't Know|Knew It →
Which loop executes at least once regardless of condition?
Which loop executes at least once regardless of condition?
Tap to reveal answer
Do-while loop. Condition checked after execution, guaranteeing minimum one iteration.
Do-while loop. Condition checked after execution, guaranteeing minimum one iteration.
← Didn't Know|Knew It →
What is a syntax error?
What is a syntax error?
Tap to reveal answer
An error in the code's grammar or structure. Violates language rules preventing code from compiling or running.
An error in the code's grammar or structure. Violates language rules preventing code from compiling or running.
← Didn't Know|Knew It →
What is a recursive function?
What is a recursive function?
Tap to reveal answer
A function that calls itself. Solves problems by breaking them into smaller identical subproblems.
A function that calls itself. Solves problems by breaking them into smaller identical subproblems.
← Didn't Know|Knew It →
What does 'DRY' stand for in programming?
What does 'DRY' stand for in programming?
Tap to reveal answer
Don't Repeat Yourself. Principle promoting code reusability by avoiding duplication.
Don't Repeat Yourself. Principle promoting code reusability by avoiding duplication.
← Didn't Know|Knew It →
Find and correct the error: 'for(int i = 0; i < 10; i+)'
Find and correct the error: 'for(int i = 0; i < 10; i+)'
Tap to reveal answer
Correct: 'for(int i = 0; i < 10; i++)'. Missing second '+' in increment operator; should be 'i++'.
Correct: 'for(int i = 0; i < 10; i++)'. Missing second '+' in increment operator; should be 'i++'.
← Didn't Know|Knew It →
What is the role of an algorithm in program design?
What is the role of an algorithm in program design?
Tap to reveal answer
To outline the step-by-step solution to a problem. Provides clear, logical sequence of instructions to solve problems.
To outline the step-by-step solution to a problem. Provides clear, logical sequence of instructions to solve problems.
← Didn't Know|Knew It →
Which programming construct is used for decision making?
Which programming construct is used for decision making?
Tap to reveal answer
Conditional statements. if-else and switch statements control program flow based on conditions.
Conditional statements. if-else and switch statements control program flow based on conditions.
← Didn't Know|Knew It →
Identify the first step in the program development life cycle.
Identify the first step in the program development life cycle.
Tap to reveal answer
Problem analysis. Understanding requirements before designing solutions is essential first step.
Problem analysis. Understanding requirements before designing solutions is essential first step.
← Didn't Know|Knew It →
What is the primary purpose of program documentation?
What is the primary purpose of program documentation?
Tap to reveal answer
To explain code logic and facilitate future maintenance. Comments and structure make code understandable for others and future edits.
To explain code logic and facilitate future maintenance. Comments and structure make code understandable for others and future edits.
← Didn't Know|Knew It →
Which data structure uses LIFO order?
Which data structure uses LIFO order?
Tap to reveal answer
Stack. Last In, First Out - elements added/removed from same end.
Stack. Last In, First Out - elements added/removed from same end.
← Didn't Know|Knew It →
Identify the error: 'switch(x) { case 1: x+=1; break; default: x-=1; }'
Identify the error: 'switch(x) { case 1: x+=1; break; default: x-=1; }'
Tap to reveal answer
No error. Proper switch syntax with break statements and default case.
No error. Proper switch syntax with break statements and default case.
← Didn't Know|Knew It →
What is the purpose of version control in software development?
What is the purpose of version control in software development?
Tap to reveal answer
To manage changes to source code over time. Tracks modifications, enables collaboration, and maintains code history.
To manage changes to source code over time. Tracks modifications, enables collaboration, and maintains code history.
← Didn't Know|Knew It →
What is an API?
What is an API?
Tap to reveal answer
Application Programming Interface. Interface defining how software components communicate and interact.
Application Programming Interface. Interface defining how software components communicate and interact.
← Didn't Know|Knew It →
What is the difference between a class and an object?
What is the difference between a class and an object?
Tap to reveal answer
Class is a blueprint; object is an instance. Template defines structure; instance contains actual data values.
Class is a blueprint; object is an instance. Template defines structure; instance contains actual data values.
← Didn't Know|Knew It →
What is a variable's scope?
What is a variable's scope?
Tap to reveal answer
The region of code where the variable is accessible. Determines where variables can be accessed within program structure.
The region of code where the variable is accessible. Determines where variables can be accessed within program structure.
← Didn't Know|Knew It →
What is the purpose of a loop in programming?
What is the purpose of a loop in programming?
Tap to reveal answer
To repeat a block of code multiple times. Automates repetitive tasks by controlling iteration and flow.
To repeat a block of code multiple times. Automates repetitive tasks by controlling iteration and flow.
← Didn't Know|Knew It →
Identify the error: 'if (x > y) x = 10; else; y = 10;'
Identify the error: 'if (x > y) x = 10; else; y = 10;'
Tap to reveal answer
Remove ';' after else. Semicolon after else creates syntax error in conditional structure.
Remove ';' after else. Semicolon after else creates syntax error in conditional structure.
← Didn't Know|Knew It →
What is inheritance in object-oriented programming?
What is inheritance in object-oriented programming?
Tap to reveal answer
Mechanism for one class to inherit attributes and methods from another. Child classes acquire properties and behaviors from parent classes.
Mechanism for one class to inherit attributes and methods from another. Child classes acquire properties and behaviors from parent classes.
← Didn't Know|Knew It →
What is the function of a compiler?
What is the function of a compiler?
Tap to reveal answer
To convert source code into machine code. Translates high-level code into executable machine instructions.
To convert source code into machine code. Translates high-level code into executable machine instructions.
← Didn't Know|Knew It →
What is the difference between 'public' and 'private' access modifiers?
What is the difference between 'public' and 'private' access modifiers?
Tap to reveal answer
'public' is accessible everywhere; 'private' is within the same class. Controls visibility and access levels for class members.
'public' is accessible everywhere; 'private' is within the same class. Controls visibility and access levels for class members.
← Didn't Know|Knew It →
Find and correct the error: 'int x = "100";'
Find and correct the error: 'int x = "100";'
Tap to reveal answer
Correct: 'int x = 100;'. String literal assigned to integer variable causes type mismatch.
Correct: 'int x = 100;'. String literal assigned to integer variable causes type mismatch.
← Didn't Know|Knew It →
What is a function's return type?
What is a function's return type?
Tap to reveal answer
The data type of the value returned by the function. Specifies what kind of value the function sends back.
The data type of the value returned by the function. Specifies what kind of value the function sends back.
← Didn't Know|Knew It →
What is an IDE?
What is an IDE?
Tap to reveal answer
Integrated Development Environment. Software providing comprehensive tools for coding, debugging, and testing.
Integrated Development Environment. Software providing comprehensive tools for coding, debugging, and testing.
← Didn't Know|Knew It →
Identify the error: 'int x = 10; float y = x / 0;'
Identify the error: 'int x = 10; float y = x / 0;'
Tap to reveal answer
Division by zero error. Mathematical impossibility that causes runtime exception or undefined behavior.
Division by zero error. Mathematical impossibility that causes runtime exception or undefined behavior.
← Didn't Know|Knew It →
What is abstraction in programming?
What is abstraction in programming?
Tap to reveal answer
Hiding complex implementation details behind simple interfaces. Simplifies complexity by exposing only essential features to users.
Hiding complex implementation details behind simple interfaces. Simplifies complexity by exposing only essential features to users.
← Didn't Know|Knew It →
Which method is the entry point for a Java application?
Which method is the entry point for a Java application?
Tap to reveal answer
main method. Starting point where JVM begins program execution.
main method. Starting point where JVM begins program execution.
← Didn't Know|Knew It →
What does 'MVC' stand for in software design?
What does 'MVC' stand for in software design?
Tap to reveal answer
Model-View-Controller. Architectural pattern separating presentation, logic, and data concerns.
Model-View-Controller. Architectural pattern separating presentation, logic, and data concerns.
← Didn't Know|Knew It →
Find and correct the error: 'int[] arr = new int(5);'
Find and correct the error: 'int[] arr = new int(5);'
Tap to reveal answer
Correct: 'int[] arr = new int[5];'. Square brackets for arrays, not parentheses like method calls.
Correct: 'int[] arr = new int[5];'. Square brackets for arrays, not parentheses like method calls.
← Didn't Know|Knew It →