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 10 pages
Exam (elaborations)

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

Document preview thumbnail
Preview 2 out of 10 pages

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

Content preview

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




what is a natural number - ANSWER- an integer greater than or equal to 0


in the instance method n.methodName(arguments); ______ is called the receiver and the
corresponding distinguished formal parameter has the name ______- - ANSWER- n; this



what does "#cat" mean - ANSWER- the previous value of cat



what does m.add(k) do - ANSWER- adds k to value of m (changes value of m but not value of
k)


what does m.subtract(k) do - ANSWER- subtracts k from value of m (changes value of m but
not of k)


what does m.multiply(k) do - ANSWER- multiplies m by value of k (changes value of m but
not of k)


what does NaturalNumber r = m.divide(k) do - ANSWER- divides m by k and returns the
remainder to variable r


what does m.copyFrom(k) do - ANSWER- copies value of k into value of m



what does int comp = m.compareTo(k) do - ANSWER- compares value of m to k; if m > k,
comp gets set to 1, if equal, comp = 0 and if less than, comp = -1


what does m.multiplyBy10(d) do - ANSWER- multiplies m by 10 then adds k

, what does int r = m.divideBy10() do - ANSWER- divides m by 10 and sets r equal to the
remainder


boolean z = m.isZero() - ANSWER- returns z to true if m is zero



what does m.clear() do - ANSWER- sets value of m to zero



m.transferFrom(k) - ANSWER- sets value of m = k and resets k to zero



String s = m.toString - ANSWER- returns the string version of m to s (ex: if m = 143, s = "143")



primitive types vs reference types - ANSWER- primitive types are boolean, char, int, double;
reference types are String, XMLTree, SimpleReader, etc.


primitive variable - ANSWER- variable of a primitive type (int, double, boolean, char)



reference variable - ANSWER- variable of a reference type (XMLTree, String)



reference value vs object value - ANSWER- object value is the actual value while reference
value is the memory address of the object


notation for reference value - ANSWER- triangle with arrow pointing to object value



when you do String s = t, changing the value of t ___________ - ANSWER- changes the value
of s


when doing NaturalNumber n = z, changing the value of n ________ - ANSWER- changes the
value of z

Document information

Uploaded on
June 1, 2025
Number of pages
10
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.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