Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

CS 302 Chapter 9 Exam Questions and Answers Graded A+

Rating
-
Sold
-
Pages
37
Grade
A+
Uploaded on
31-01-2026
Written in
2025/2026

CS 302 Chapter 9 Exam Questions and Answers Graded A+

Institution
CS302
Course
CS302

Content preview

CS 302 Chapter 9 Exam Questions and
Answers Graded A+

Object - Correct answer-represents an entity in the real world that can be distinctly

identified.

An object is an instance of a class.

Pg. 322

Object creation - Correct answer-The syntax for creating an object:

classname objectReferenceVariable = new classname(arguments if any);

Ex: TV tv1 = new TV(arguments if any)

Pg. 328

Data fields - Correct answer-the state of the object (also known as its properties or

attributes) is represented by data fields with their current values

java uses variables to define data fields

Ex: A circle object has a data field radius which is the property that characterizes

the circle

©COPYRIGHT 2025, ALL RIGHTS RESERVED 1

,Ex: a rectangle object has the data fields width and height which are the properties

that characterize a rectangle

Pg. 323

Behavior of an object - Correct answer-The behavior of an object (also known as

its actions) is defined by methods. To invoke a method on an object is to ask the

object to perform an action

Ex: you may define methods named getArea() and getPerimeter() for circle

objects. A circle object may invoke getArea() to return its area and getPerimeter t0

to return its perimeter

Pg. 323

Class - Correct answer-Objects of the same type are defined using a common class

A class is a template, blueprint or contract the defines what an objects data fields or

methods will be.

A class provides constructors for creating objects and methods for manipulating

them

An object is an Instance of a class. You can create many instances of a class

creating an instance is referred to as INSTANTIATION

A class is also a data type, you can use it to declare reference variables.
©COPYRIGHT 2025, ALL RIGHTS RESERVED 2

,Note: object and instance are used interchangeably

Pg. 323

Constructors - Correct answer-Constructors are special methods that are called

when an object is instantiated. A constructor initializes the created instance.

Typically the constructor initializes the fields of the object that need initialization.

They can perform any action, but constructors are designed to perform initializing

actions, such as initializing the data fields of objects.

Say there were 2 constructors:

Circle(){ //No-arg constructor

radius = 1; //data field radius is initalized to 1

}

Circle(int newRadius){ // argument of type int called newRadius

radius = newRadius; // datafield radius is initalized

}

So if an object was created, the term "new" with no arguments it would invoke the

constructor with the same type of arguments (in this case the constructor with no

arguments)


©COPYRIGHT 2025, ALL RIGHTS RESERVED 3

, So if an object was created with arguments of type int, Ex: Circle myCircle = new

Circle(25), the term "new" would invoke the constructor with the same arguments

(in this case the second constructor with the arguments of type int

Pg 323

UML - Correct answer-Unified modeling language. Class templates and objects

can be illustrated using this UML.

Pg. 323

Data Field syntax - Correct answer-Uses UML

Syntax:

dataFieldname: dataFieldType

Ex: double radius = 1;

Pg. 323

Constructor Syntax - Correct answer-Uses UML

Syntax:

ClassName(parameter name: parameterType)

Ex: Circle(double newRadius) {

}
©COPYRIGHT 2025, ALL RIGHTS RESERVED 4

Written for

Institution
CS302
Course
CS302

Document information

Uploaded on
January 31, 2026
Number of pages
37
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$12.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
EmillyCharlotte Howard Community College
Follow You need to be logged in order to follow users or courses
Sold
136
Member since
1 year
Number of followers
5
Documents
12389
Last sold
1 day ago
ALL-MAJOR.

On this page, you find all documents, package deals, and flashcards offered by seller Emilly Charlotte.

3.5

31 reviews

5
10
4
10
3
2
2
3
1
6

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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions