Writing Classes in AP Computer Science A
Which of the following variables can be accessed by any class in the same package and/or an external subclass of the class its in?
private int num = 5;
There is no such modifier that allows this kind of access for variables.
int num = 5;
protected int num = 5;
Which kind of testing checks specific parts of software to ensure they behave as intended in isolation from other components?
Acceptance Testing
Unit Testing
Integration Testing
System Testing
In Java programming language constants are defined using which modifier combination?
private final
public transient
volatile const
final static
Which of the following standard algorithms can be used to search for an element in an unsorted array and will always require examining each element at least once if the element is not present?
Insertion sort
Linear search
Binary search
Merge sort
Which data structure should be used to ensure the fastest retrieval of elements inserted in sorted order without additional sorting steps after each insertion?
Stack
PriorityQueue
Vector
ArrayList
What is an example of an instance variable in Java?
One that is declared within a class but not within a method block
Local one that is declared within a method block
Global one that is declared outside of any class
Parameter one that is passed into a method
If a public instance method m1() calls another private instance method m2() within the same class, which statement accurately describes this scenario?
Private method m2() cannot be called by any other methods because it is private.
Method m1() needs an object reference to call method m2(), even though it's in the same class.
Method m1() must also be private if it wants to call any private methods like m2().
Method m1() has access to call method m2() because both are members of the same class.

How are we doing?
Give us your feedback and let us know how we can improve
In Java, which keyword would you use to declare a constant whose value should not change after initialization and must be accessible only within its own class?
private final
public final
protected final
public static
Which type of Java variable has its scope limited to the block it is declared in?
Local variable
Class variable
Instance variable
Global variable
If a method parameter has the same name as an instance variable, which one will be used within the method body without specifying 'this'?
Class constant
Static field
Method parameter
Instance variable