AP Computer Science A Practice Quiz: this Keyword
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Test your understanding with short quizzes. This quiz has 9 questions to check your progress.
Question 1 of 9
All Questions (9)
A) A reference to the class in which the method is defined.
B) A reference to the superclass of the current object.
C) A reference to the current object whose method or constructor is being called.
D) A reference to a new object that will be created.
Correct Answer: C
The provided content states that 'the keyword this acts as a special variable that holds a reference to the current object—the object whose method or constructor is being called.'
A) model = model;
B) this.model = model;
C) Car.model = model;
D) new Car().model = model;
Correct Answer: B
To distinguish between the instance variable `model` and the parameter `model`, the keyword `this` is used. `this.model` is a self-referencing expression that refers to the instance variable of the current `Car` object.
A) new EventSource()
B) EventSource.class
C) this
D) logger
Correct Answer: C
The content states that `this` can be used to pass the current object as an argument in a method call. Inside the `triggerEvent` method, `this` refers to the current `EventSource` instance.
A) 10
B) 13
C) 15
D) 18
Correct Answer: D
The `move` method uses a self-referencing expression `return this;` to return the current `Point` object. This allows method calls to be chained. The first call, `p.move(5)`, changes `x` to 15 and returns `p`. The second call, `p.move(3)`, changes `x` to 18. The final output is 18.
A) Within a static method.
B) Within an instance method.
C) Outside of any class definition.
D) Within a static initializer block.
Correct Answer: B
The provided content specifies that `this` can be used 'within an instance method or a constructor'. Static methods are associated with the class, not a specific object instance, so `this` has no meaning there.
A) The `Employee` class.
B) The `e1` object.
C) The `e2` object.
D) A null reference.
Correct Answer: B
The keyword `this` always refers to the object on which the method was invoked. In the expression `e1.isSamePerson(e2)`, the method is called on the `e1` object, so `this` is a reference to `e1`.
A) false
B) true
C) It causes a NullPointerException.
D) It fails to compile.
Correct Answer: B
In the call `m1.assignTask(taskA)`, the `this` keyword inside the `assignTask` method refers to the `m1` object. The line `t.setManager(this)` passes `m1` as an argument to the `setManager` method of `taskA`. This sets `taskA`'s `assignedManager` field to the `m1` object. Therefore, `taskA.getManager()` returns `m1`, and the comparison `== m1` is true.
A) A method that calls itself recursively.
B) An expression, such as `this.name`, used by an object to refer to its own instance variables or methods.
C) An object that is an instance of its own class.
D) A variable that holds a reference to a static copy of the object.
Correct Answer: B
A self-referencing expression is one where an object refers to itself. Using `this` to access its own members (e.g., `this.name` or `this.myMethod()`) is the primary way to do this.
A) obj2.process(A);
B) obj2.process(new A());
C) obj2.process(this);
D) this.process(obj2);
Correct Answer: C
The requirement is for `obj1` to pass *itself* as an argument. Inside an instance method of `obj1`, the keyword `this` is the reference to `obj1`. Therefore, `obj2.process(this)` correctly passes the current object (`obj1`) to `obj2`'s `process` method.