Classes & OOP
Operators & Casting
Arrays
Encapsulation & Methods
100

This term describes a blueprint for creating objects; it defines attributes and behaviors.

Class

100

The shorthand operator that adds a value to a variable and assigns the result in one step (write the operator symbol)

+=

100

What Java syntax indicates a variable is an array of integers (two possible common forms)?

int[] or int arrayName[]

100

What keyword would you give a variable so it's only accessible inside its class (one-word answer)?

private

200

Name the term for a specific instance created from a class.

Object (instance) 

200

Write an equivalent expression: speed += 10; (give the full expanded assignment)

speed = speed + 10

200

If you create an array with an initializer list like {2, 4, 6}, can you later add a new element to change its size? Explain briefly.

No — array size is fixed; you cannot change capacity after creation.

200

What are getters and setters used for? Provide a short definition for each.

Getter returns a variable's value; setter assigns/validates a new value.

300

The keyword used inside a class to refer to the current object (for example, used to reference instance variables when parameter names collide).

this.

300

Identify whether the following is postfix or prefix: variable++ — and explain what postfix means in terms of when the increment happens relative to using the value

Postfix; increment happens after the expression uses the current value.

300

What is the default value for elements in a new int[] array in Java (before you set any elements)?

0

400

This special method initializes an object when it's created and often has the same name as the class.

Constructor

400

Define implicit casting and give a simple example converting an int to a double using a variable named a

Implicit casting automatically converts smaller to larger types; example: int a = 22; double b = a; 401: int d = (int) c; d becomes 22

400

Given an array named scores, write a single-line Java for-loop header (only the header) that traverses all indices from 0 to length-1.

for (int i = 0; i < scores.length; i++){}

400

The notes call encapsulation a principle — restate that principle in your own words, referencing protection or control of data.

Encapsulation protects data by restricting access and providing controlled interfaces (getters/setters).

500

Explain in one sentence why Java is considered an object-oriented language (mention classes or objects).

Because Java models programs using classes that define objects with attributes and behaviors (answers may vary; teacher judgment).

500

Describe two common uses of traversing arrays (give any two examples from the notes)

Print all values, find average, totals, search, modify values (any two).

500

Suppose you have a private instance variable age. Write a getter method signature (Java) that returns an int called getAge (just the signature line, not the body).

public int getAge();

M
e
n
u