PrepGo

AP Computer Science A Flashcards: Variables and Data Types

Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026

Review key ideas with interactive flashcards. This set includes 10 cards to help you master important concepts.

What are the two main categories of data types?
Data types can be categorized as either primitive or reference.
Card 1 of 10

All Flashcards (10)

What are the two main categories of data types?
Data types can be categorized as either primitive or reference.
What type of value is stored in an `int` variable?
An `int` value is an integer (a whole number).
Which primitive data type is most appropriate for storing a student's GPA, such as 3.75?
The `double` data type is most appropriate because a GPA is a real number.
What is a data type?
A data type is a set of values and a corresponding set of operations on those values.
What are the possible values for a `boolean` variable?
A `boolean` value is either true or false.
What is a variable?
A variable is a storage location that holds a value, which can change while the program is running. It has a name and an associated data type.
What are the three primitive data types used in this course?
The three primitive data types used in this course are int, double, and boolean.
What type of value is stored in a `double` variable?
A `double` value is a real number, which can include decimals.
Which primitive data type is best for a variable that tracks whether a user is logged in?
The `boolean` data type is best, as it can represent the two states: logged in (true) or not logged in (false).
Which primitive data type would you use to store the number of pages in a book?
The `int` data type should be used because the number of pages is an integer.