Algorithms, Compilers, and Variables
Free AP Computer Science A multiple-choice practice for topics 1.1–1.2, Unit 1 (Using Objects and Methods). Answer five random questions, check your work, and review the essential knowledge behind each one.
Unit 1: Using Objects and Methods. Topics 1.1–1.2. This set has 55 questions. Each time the page loads you get five of them, chosen at random. Pick an answer, press Check answer, and read the explanation for every choice. Reload the page or use New questions for a fresh five.
Topics assessed
- 1.1 Introduction to Algorithms, Programming, and Compilers
- 1.2 Variables and Data Types
Practice questions
Loading questions…
Essential knowledge for this set
These are the essential knowledge (EKS) statements from the AP Computer Science A Course and Exam Description that the 55 questions in this set assess, grouped by topic and learning objective. The table under each question links here.
Topic 1.1: Introduction to Algorithms, Programming, and Compilers
1.1.A — Represent patterns and algorithms found in everyday life using written language or diagrams.
- 1.1.A.1 Algorithms define step-by-step processes to follow when completing a task or solving a problem. These algorithms can be represented using written language or diagrams.
- 1.1.A.2 Sequencing defines an order for when steps in a process are completed. Steps in a process are completed one at a time.
1.1.B — Explain the code compilation and execution process.
- 1.1.B.1 Code can be written in any text editor; however, an integrated development environment (IDE) is often used to write programs because it provides tools for a programmer to write, compile, and run code.
- 1.1.B.2 A compiler checks code for some errors. Errors detectable by the compiler need to be fixed before the program can be run.
1.1.C — Identify types of programming errors.
- 1.1.C.1 A syntax error is a mistake in the program where the rules of the programming language are not followed. These errors are detected by the compiler.
- 1.1.C.2 A logic error is a mistake in the algorithm or program that causes it to behave incorrectly or unexpectedly. These errors are detected by testing the program with specific data to see if it produces the expected outcome.
- 1.1.C.3 A run-time error is a mistake in the program that occurs during the execution of a program. Run-time errors typically cause the program to terminate abnormally.
- 1.1.C.4 An exception is a type of run-time error that occurs as a result of an unexpected error that was not detected by the compiler. It interrupts the normal flow of the program’s execution.
Topic 1.2: Variables and Data Types
1.2.A — Identify the most appropriate data type category for a particular specification.
- 1.2.A.1 A data type is a set of values and a corresponding set of operations on those values. Data types can be categorized as either primitive or reference.
- 1.2.A.2 The primitive data types used in this course define the set of values and corresponding operations on those values for numbers and Boolean values.
- 1.2.A.3 A reference type is used to define objects that are not primitive types.
1.2.B — Develop code to declare variables to store numbers and Boolean values.
- 1.2.B.1 The three primitive data types used in this course are int, double, and boolean. An int value is an integer. A double value is a real number. A boolean value is either true or false.
- 1.2.B.2 A variable is a storage location that holds a value, which can change while the program is running. Every variable has a name and an associated data type. A variable of a primitive type holds a primitive value from that type.