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
Document preview thumbnail
Preview 2 out of 13 pages
Exam (elaborations)

CSE 2221 Midterm Exam 2 Prep 2025. | Exam Revision Questions And Correct Answers | Graded A+ | 2025 Update |

Document preview thumbnail
Preview 2 out of 13 pages

CSE 2221 Midterm Exam 2 Prep 2025. | Exam Revision Questions And Correct Answers | Graded A+ | 2025 Update |

Content preview

CSE 2221 Midterm Exam 2 Prep 2025. | Exam Revision Questions And
Correct Answers | Graded A+ | 2025 Update |




what is the definition of the size of a tree? - ANSWER- # of nodes in a tree



what is the definition of the height of a tree? - ANSWER- longest path from root to leaf in a
tree (largest # of nodes)


what is the definition of a path? what is the length of a path? - ANSWER- a series of nodes
connected by edges where each node is a parent or child of another


length is the # in a path


what is the value range of a NaturalNumber? - ANSWER- [0, ∞) technically limited by memory
though


what is the benefit of using the String constructor over the int constructor? - ANSWER- int has
a limit while Sytring has a much, much longer limit


what types of methods are in the NaturalNumber interface(s)? - ANSWER- instance methods



if I write "nn.isZero();" what is "nn" called? - ANSWER- receiver



what does "@ensures this = #this + 1" mean in a method contract? - ANSWER- new value of
this will be equal to the old value of this plus one


if I write "nn.increment()", does anything change about "nn"? what changes? - ANSWER- yes,
object value changes

, when should you use copyFrom over transferFrom? - ANSWER- if you have x.copyFrom(y),
this says you will still need y at its current value later in the code


if n1 > n2, what is the result of "n1.compareTo(n2)"? - ANSWER- any value x where x > 0 (i.e.
a positive number)


in the function call "nn.multiplyBy10(k)", what is "k" for? - ANSWER- adding to ones place
after multiplying


what are the kernel methods? - ANSWER- isZero, multiplyBy10, divideBy10
very essential methods to be used in all NaturalNumber objects


what is the default value of a NaturalNumber? - ANSWER- 0



what is the resulting object value of the argument passes to a transferFrom call? - ANSWER-
0


what are reference types associated with? - ANSWER- objects



is String a primitive or reference type? - ANSWER- reference



is the value of a primitive type the actual value or is it a memory address? - ANSWER- actual



is the value of a reference type the actual value or is it a memory address? - ANSWER- memory



how many values does a reference type have? what are they? - ANSWER- 2 - reference value
and object value

Document information

Uploaded on
June 1, 2025
Number of pages
13
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$11.99

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

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.
LECTpharis
4.8
(8)
Sold
41
Followers
1
Items
6040
Last sold
2 months ago




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