zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcardStudy GuideStudy GuideQuestion BankQuestion Bank
GlossaryGlossary

Writing Classes in AP Computer Science A

Question 1
college-boardComputer Science AAPExam Style
1 mark

The data type of a mutator method's parameter is...

Question 2
college-boardComputer Science AAPExam Style
1 mark

If a public mutator method inadvertently modifies a static field instead of an instance field in a class representing bank accounts, what consequence might that have on individual bank account objects?

Question 3
college-boardComputer Science AAPExam Style
1 mark

If a class has no mutator methods, it is said to be...

Question 4
college-boardComputer Science AAPExam Style
1 mark

What advantage does encapsulating fields and providing public mutator methods have over typically using public fields?

Question 5
college-boardComputer Science AAPExam Style
1 mark

What type of value does a typical mutator method return in Java?

Question 6
college-boardComputer Science AAPExam Style
1 mark

Which of the following best describes the purpose of a mutator method in an object-oriented program?

Question 7
college-boardComputer Science AAPExam Style
1 mark

When refactoring a class DataAnalyzer's mutator methods to improve performance, which modification will most likely reduce the time complexity when dealing with large datasets?

Feedback stars icon

How are we doing?

Give us your feedback and let us know how we can improve

Question 8
college-boardComputer Science AAPExam Style
1 mark

Why does the following class does not compile? public class Weather { private int currentTemp;

public Weather(int temp)
{
    currentTemp = temp;
}

public void resetTemp(double newTemp)
{
    currentTemp = newTemp;
}

}

Question 9
college-boardComputer Science AAPExam Style
1 mark

What does a mutator method typically return in Java?

Question 10
college-boardComputer Science AAPExam Style
1 mark

Following the naming convention for mutators methods, what should the name of the method that updates the value of an instance variable named "age" be?