100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

AP Computer Science Unit 5 Test Question and answers already passed 2025

Rating
-
Sold
-
Pages
47
Grade
A+
Uploaded on
07-04-2025
Written in
2024/2025

AP Computer Science Unit 5 Test Question and answers already passed 2025 T/F A class is a blueprint for a type of Java object - correct answer True T/F A java object has data and behavior - correct answer True You can add behavior to an object by adding_____ to the class - correct answer methods To make objects easily printable, write a ____ method that returns a text representation - correct answer toString A class's ____ creates a new object that may contain initial values for the fields - correct answer constructor

Show more Read less
Institution
AP Computer Science Unit 5
Course
AP Computer Science Unit 5











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
AP Computer Science Unit 5
Course
AP Computer Science Unit 5

Document information

Uploaded on
April 7, 2025
Number of pages
47
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

AP Computer Science Unit 5 Test
Question and answers already passed
2025
T/F A class is a blueprint for a type of Java object - correct answer ✔True


T/F A java object has data and behavior - correct answer ✔True


You can add behavior to an object by adding_____ to the class - correct
answer ✔methods


To make objects easily printable, write a ____ method that returns a text
representation - correct answer ✔toString


A class's ____ creates a new object that may contain initial values for the
fields - correct answer ✔constructor


Fields can be protected from external modification by making them ____ -
correct answer ✔private


T/F private fields can be directly changed from the client code - correct
answer ✔false


T/F A class is an instance of an object. One object can be used to create
many classes - correct answer ✔false


What is the term for having multiple constructors with different parameters -
correct answer ✔overloading

,What is the correct way to create a Name object - correct answer ✔Name n
= new Name("Will", "c", "Smith");


What is the correct way to create a Point object - correct answer ✔Point p =
new Point(2,3);


What what is true about code p1 and p2 with the same points - correct
answer ✔It creates two Point objects with identical data


A Pokémon object (p1) has a damage method. What is the correct way to call
the damage method - correct answer ✔p1.damage();


Methods that change an objects fields are called - correct answer
✔setters/mutators


A BankAccount object (acct) has a computeInterest method. What is the
correct way to call it - correct answer ✔double result =
acct.computeInterest(42);


What is the correct method header for the toString method - correct answer
✔public String toString() {


What is the correct syntax for a constructor for the Book class - correct
answer ✔public Book(String title, String author){


T/F A class may contain multiple constructors - correct answer ✔true

,T/F Constructors may call other constructors("chaining") - correct answer
✔true


T/F You can access fields inside a class's methods - correct answer ✔true


How do you access private fields from client code - correct answer ✔use
getters/setters


T/F A class can have a filed that is a array - correct answer ✔true


What is an instance method - correct answer ✔A method that can be called
using an object


T/F Getters and Setters are instance methods - correct answer ✔true


The Car class will contain two string attributes for a car's make and model.
The class will also contain a constructor.


public class Car
{
/* missing code */
}


Which of the following replacements for /* missing code */ is the most
appropriate implementation of the class?


A)
public String make;

, public String model;


public Car(String myMake, String myModel)
{ /* implementation not shown */ }


B)
public String make;
public String model;


private Car(String myMake, String myModel)
{ /* implementation not shown */ }


C)
private String make;
private String model;


public Car(String myMake, String myModel)
{ /* implementation not shown */ }


D)
public String make;
private String model;


private Car(String myMake, String myModel)
( /* implementation not shown */ }

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
flyhigher329 Liberty University
View profile
Follow You need to be logged in order to follow users or courses
Sold
335
Member since
2 year
Number of followers
175
Documents
16230
Last sold
6 hours ago
STUDY GUIDES & ALL NURSING AND MORE EXAMS(RATED A+)

ARE YOU LOOKING FOR EXAMS!! MAY IT BE NURSING,EMT,REALTORS e.t.c WELCOME TO OUR SHOP FOR ALL YOU NEED TO PASS COZ WE ARE VERIFIED AND GUARANTEED TO PASS, DONT FORGET TO GIVE A REVIEW AFTER YOU HAVE PASSED THE EXAMS.........

3.8

55 reviews

5
24
4
10
3
13
2
4
1
4

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions