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

AP Computer Science Midterm Practice EXAM- Java Basics, Arrays QUESTIONS WITH ANSWERS 2023

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
08-02-2024
Written in
2023/2024

AP Computer Science Midterm Practice EXAM- Java Basics, Arrays QUESTIONS WITH ANSWERS 2023 Class - ANSWER Java code as a template for an Object (this is abstract code not tied to any specific instance of the object) Instance - ANSWER One object made from the class template (has own instance variables, methods, identity, etc.) Instance Variable - ANSWER variables used to maintain the state of an instance (persistent) Constructor - ANSWER code that is run when you use the new keyword Method - ANSWER code to respond to a message Public variable - ANSWER In a class, anything marked as "public" can be accessed by any client. Private Variable - ANSWER Anything marked "private" can only be accessed inside the class code. Are instance variables public or private? - ANSWER instance variables are private Are constructors and methods public or private? - ANSWER constructors are public methods are public What is a mutator? - ANSWER A setter What is an accessor? - ANSWER A getter Do getters or setters return something? - ANSWER Getters What does a "Public String toString()" do? - ANSWER Does NOT print anything - just creates a String with "state" information toString() example - ANSWER public String toString () { String str; str ="Name: " + name + "n" + "id: " + id + "n" + "Test 1: " + test1 + "n" + "Test 2: " + test2 + "n" + "Test 3: " + test3 + "n" + "Average: " + getAverage(); return str; } makes a new string variable, sets it to variables in the element, and returns it. Object - ANSWER a programming construction that manages its own data and responds to messages from other objects: State - ANSWER describes its current condition (properties, nouns) Behavior - ANSWER describes what it (object) can do (actions, responses, verbs) Identity - ANSWER differentiates one instance from another (like an id number or location in memory) Class (OOP Definition #2) - ANSWER The code you write Defines an object's "state" (as variables) Defines an object's "behavior" (as methods, i.e. functions) "template" or "mold" for creating new objects Tells Java "how" to create an object Instance (OOP Definition #2) - ANSWER Instance = A single actual object "created" based on the template (the class) - the data+code that is actually stored in memory Maintains own "state" Exhibits own "behavior" Maintains own "identity" Two instances, like two cookies made from the same cookiecutter, are still different Referenced with the new keywor

Show more Read less
Institution
AP Computer S
Course
AP Computer S









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

Written for

Institution
AP Computer S
Course
AP Computer S

Document information

Uploaded on
February 8, 2024
Number of pages
5
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

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.
STUDENTSCORE NURSING
View profile
Follow You need to be logged in order to follow users or courses
Sold
12
Member since
1 year
Number of followers
6
Documents
1383
Last sold
5 months ago
EXCELLENT HOMEWORK HELP AND TUTORING ,ALL KIND OF QUIZ AND EXAMS WITH GUARANTEE OF A EXCELLENT HOMEWORK HELP AND TUTORING ,ALL KIND OF QUIZ AND EXAMS WITH GUARANTEE OF A Am an expert on major courses especially; psychology,Nursing, Human resource Manageme

EXCELLENT HOMEWORK HELP AND TUTORING ,ALL KIND OF QUIZ AND EXAMS WITH GUARANTEE OF A EXCELLENT HOMEWORK HELP AND TUTORING ,ALL KIND OF QUIZ AND EXAMS WITH GUARANTEE OF A Am an expert on major courses especially; psychology,Nursing, Human resource Manageme

4.3

3 reviews

5
2
4
0
3
1
2
0
1
0

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