AP CSA

Variables and assignment To facts …

Topic Basic Intermediate Advanced
What’s going on inside a computer?
Decribe the role of the central processing unit (CPU) in a computer.
Describe the role of memory (RAM) in a computer.
Describe what happens when Java evaluates an assignment like x = x + 1
in terms of the CPU and memory.
Explain the purpose of CPU registers and cache and how they relate to RAM.
Explain the difference between local and non-local variables in terms of where they live in memory.
Variables
Explain how variables in programming are different from variables in math.
Explain the difference between "foo" and foo.
Declaring variables
Identify the components of a variable declaration (type and name)
Describe the purpose of declaring a variable.
Describe standard naming style for variables.
Define the difference between declaring and initializing a variable.
Write variable declarations with and without initialization.
Declare variables of different types.
Use the final keyword for constants
Understand the difference between local and member variables
Understand the concept of variable scope
Variables holding reference types
Declare variables of reference types
Describe what happens in memory when we evaluate a = b if a and b are both variables of some reference type.
Describe what happens to b if we call a method like a.modify() that changes a’s state after the assignment above.
Describe what happens to the object previously assigned to a variable a when we assign a new value to a.
Describe the concept of garbage collection in Java.
Assignment operators
Assign a literal value to a variable with =.
Assign a computed value to a variable expressions using =.
Assign a value computed from an expressions involving the variable itself to the variable using =.
Use compound assignment operators: +=, -=, *=, /=, and %=
Use ++ and --
Assign new values to int and double variables computed from expressions of the other type using casting as appropriate.
Variable scope
Describe the basic concept of a variable’s scope.
Identify the scope of a local variable declaration.
Identify the scope of a instance variable declaration.
Modify code to move variables to narrower scope when possible.
Explain why minimizinng the scope variables is a good idea.
Define the “extent” of a variable and contrast it with the variable’s scope.