CSE 2221 Midterm 2 2025 UPDATE Verified Questions And Answers |
CSE 2221 Midterm 2
With 100% Correct Answers graded A+ Guaranteed Success!!
Study online at https://quizlet.com/_643dbg
1. what is a natural number an integer greater than or equal to 0
2. in the instance method n.method- n; this
Name(arguments); ______ is called the
receiver and the corresponding dis-
tinguished formal parameter has the
name ______-
3. what does "#cat" mean the previous value of cat
4. what does m.add(k) do adds k to value of m (changes value of m but not
value of k)
5. what does m.subtract(k) do subtracts k from value of m (changes value of m but
not of k)
6. what does m.multiply(k) do multiplies m by value of k (changes value of m but
not of k)
7. what does NaturalNumber r = m.di- divides m by k and returns the remainder to variable
vide(k) do r
8. what does m.copyFrom(k) do copies value of k into value of m
9. what does int comp = m.compare- compares value of m to k; if m > k, comp gets set to
To(k) do 1, if equal, comp = 0 and if less than, comp = -1
10. what does m.multiplyBy10(d) do multiplies m by 10 then adds k
11. what does int r = m.divideBy10() do divides m by 10 and sets r equal to the remainder
12. boolean z = m.isZero() returns z to true if m is zero
13. what does m.clear() do sets value of m to zero
1/9
, CSE 2221 Midterm 2
Study online at https://quizlet.com/_643dbg
14. m.transferFrom(k) sets value of m = k and resets k to zero
15. String s = m.toString returns the string version of m to s (ex: if m = 143, s
= "143")
16. primitive types vs reference types primitive types are boolean, char, int, double; refer-
ence types are String, XMLTree, SimpleReader, etc.
17. primitive variable variable of a primitive type (int, double, boolean,
char)
18. reference variable variable of a reference type (XMLTree, String)
19. reference value vs object value object value is the actual value while reference value
is the memory address of the object
20. notation for reference value triangle with arrow pointing to object value
21. when you do String s = t, changing the changes the value of s
value of t ___________
22. when doing NaturalNumber n = z, changes the value of z
changing the value of n ________
23. immutable types vs mutable types immutable types (ex: String, XMLTree, etc.) values
cannot change but mutable types (SimpleRead-
er, NaturalNumber, etc.) values can change via a
method
24. what must you use to see if two .equals()
strings are equal
25. what are the only types that change natural numbers (if a method like increment is used)
when passed into a static method and arrays
2/9
CSE 2221 Midterm 2
With 100% Correct Answers graded A+ Guaranteed Success!!
Study online at https://quizlet.com/_643dbg
1. what is a natural number an integer greater than or equal to 0
2. in the instance method n.method- n; this
Name(arguments); ______ is called the
receiver and the corresponding dis-
tinguished formal parameter has the
name ______-
3. what does "#cat" mean the previous value of cat
4. what does m.add(k) do adds k to value of m (changes value of m but not
value of k)
5. what does m.subtract(k) do subtracts k from value of m (changes value of m but
not of k)
6. what does m.multiply(k) do multiplies m by value of k (changes value of m but
not of k)
7. what does NaturalNumber r = m.di- divides m by k and returns the remainder to variable
vide(k) do r
8. what does m.copyFrom(k) do copies value of k into value of m
9. what does int comp = m.compare- compares value of m to k; if m > k, comp gets set to
To(k) do 1, if equal, comp = 0 and if less than, comp = -1
10. what does m.multiplyBy10(d) do multiplies m by 10 then adds k
11. what does int r = m.divideBy10() do divides m by 10 and sets r equal to the remainder
12. boolean z = m.isZero() returns z to true if m is zero
13. what does m.clear() do sets value of m to zero
1/9
, CSE 2221 Midterm 2
Study online at https://quizlet.com/_643dbg
14. m.transferFrom(k) sets value of m = k and resets k to zero
15. String s = m.toString returns the string version of m to s (ex: if m = 143, s
= "143")
16. primitive types vs reference types primitive types are boolean, char, int, double; refer-
ence types are String, XMLTree, SimpleReader, etc.
17. primitive variable variable of a primitive type (int, double, boolean,
char)
18. reference variable variable of a reference type (XMLTree, String)
19. reference value vs object value object value is the actual value while reference value
is the memory address of the object
20. notation for reference value triangle with arrow pointing to object value
21. when you do String s = t, changing the changes the value of s
value of t ___________
22. when doing NaturalNumber n = z, changes the value of z
changing the value of n ________
23. immutable types vs mutable types immutable types (ex: String, XMLTree, etc.) values
cannot change but mutable types (SimpleRead-
er, NaturalNumber, etc.) values can change via a
method
24. what must you use to see if two .equals()
strings are equal
25. what are the only types that change natural numbers (if a method like increment is used)
when passed into a static method and arrays
2/9