AP COMPUTER SCIENCE A UNIT 1 QUIZ
GRADED A+
What is a `class` in Java?
A class in Java is a blueprint for creating objects. It defines the properties (attributes) and
behaviors (methods) that the objects of that class will have.
Explain the difference between a `primitive data type` a...
✔✔ A class in Java is a blueprint for creating objects. It defines the properties (attributes) and
behaviors (methods) that the objects of that class will have.
Explain the difference between a `primitive data type` and a `reference data type`.
✔✔ A primitive data type holds simple values like integers, characters, and booleans. A
reference data type holds references to objects, such as arrays or instances of classes.
What is a `constructor` in Java?
✔✔ A constructor is a special method in a class that is called when an object of that class is
created. It is used to initialize the object's attributes.
What does the keyword `new` do in Java?
1
, ✔✔ The `new` keyword creates a new instance (object) of a class and allocates memory for it.
What is the difference between `instance variables` and `local variables`?
✔✔ Instance variables are declared in a class and are accessible by all methods in that class.
Local variables are declared inside a method and are only accessible within that method.
Explain what `method overloading` is in Java.
✔✔ Method overloading occurs when two or more methods in a class have the same name but
different parameters (different number or type of arguments).
What is the purpose of the `main()` method in a Java program?
✔✔ The `main()` method is the entry point of any Java program. It is where the program starts
execution.
What is the difference between `public` and `private` access modifiers?
2
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller BrilliantScores. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R184,66. You're not tied to anything after your purchase.