CSE 2221 MIDTERM 2 LATEST
what is the default parameter mode? - ANSWERS-restores
what is the relationship between the input parameter and a replaces
mode parameter - ANSWERS-no relationship
when we use a parameter name in a method contract, what value are we
referencing to when the parameter is a (a) primitive type or (b) reference
type? - ANSWERS-(a) THE value
(b) object value
do we allow the following statement "nn.multiply(nn); - ANSWERS-no
this != arg
what is the simplest way to create an alias? - ANSWERS-nn1 = nn2;
how many "points of contact" do you have in harmless aliasing? i.e. how
many reference variables reference an object - ANSWERS-1
how many "points of contact" do you have in harmful aliasing? -
ANSWERS-2
END OF
PAGE
1
, CSE 2221 MIDTERM 2 LATEST
can you have duplicate entries in a string? does order of the entries
matter? - ANSWERS-yes and yes
what is the mathematical string notation for programming type String
equal to "CSE2221" what is the mathematical type of this? -
ANSWERS-<'C', 'S', 'E', 2', '2', '2', '1'> string of characters
what is the mathematical string notation for programming type int equal
to [1, 6). what is the mathematical type of this? - ANSWERS-<1, 2, 3, 4,
5> string of integers
what operator do you use to concatenate two programming Strings?
what about two mathematical strings? - ANSWERS-programming --> +
math --> *
what is the definition of a substring? give an example - ANSWERS-if A
is a substring of B, all elements of A occur in B
<1, 2> --> <7, 1, 2, 4>
what is the definition of a prefix? give an example - ANSWERS-all
elements of A occur first in B
END OF
PAGE
2
, CSE 2221 MIDTERM 2 LATEST
<1, 2> --> <1, 2, 7, 6, 11>
what is the definition of a suffix? given an example - ANSWERS-all
elements of A occur last in B
<1, 2> --> <8, 14, 1, 2>
what is "s[1, 7) of "s = Go Buckeyes!"" - ANSWERS-"o Buck"
simply put, what is recursion? - ANSWERS-a function that calls itself
what must be done in order for recursion to work? Hint: can I reverse
"Hello" right now? no, so what must I do? - ANSWERS-you must pass a
small subproblem to successive method calls
we keep doing recursive steps until we reach what? what is the
significance of this point that we have reached? - ANSWERS-base case,
it is the smallest subproblem we can solve
what is the basic structure for a recursive method? - ANSWERS-if (base
case condition) {
return some basic value
END OF
PAGE
3
what is the default parameter mode? - ANSWERS-restores
what is the relationship between the input parameter and a replaces
mode parameter - ANSWERS-no relationship
when we use a parameter name in a method contract, what value are we
referencing to when the parameter is a (a) primitive type or (b) reference
type? - ANSWERS-(a) THE value
(b) object value
do we allow the following statement "nn.multiply(nn); - ANSWERS-no
this != arg
what is the simplest way to create an alias? - ANSWERS-nn1 = nn2;
how many "points of contact" do you have in harmless aliasing? i.e. how
many reference variables reference an object - ANSWERS-1
how many "points of contact" do you have in harmful aliasing? -
ANSWERS-2
END OF
PAGE
1
, CSE 2221 MIDTERM 2 LATEST
can you have duplicate entries in a string? does order of the entries
matter? - ANSWERS-yes and yes
what is the mathematical string notation for programming type String
equal to "CSE2221" what is the mathematical type of this? -
ANSWERS-<'C', 'S', 'E', 2', '2', '2', '1'> string of characters
what is the mathematical string notation for programming type int equal
to [1, 6). what is the mathematical type of this? - ANSWERS-<1, 2, 3, 4,
5> string of integers
what operator do you use to concatenate two programming Strings?
what about two mathematical strings? - ANSWERS-programming --> +
math --> *
what is the definition of a substring? give an example - ANSWERS-if A
is a substring of B, all elements of A occur in B
<1, 2> --> <7, 1, 2, 4>
what is the definition of a prefix? give an example - ANSWERS-all
elements of A occur first in B
END OF
PAGE
2
, CSE 2221 MIDTERM 2 LATEST
<1, 2> --> <1, 2, 7, 6, 11>
what is the definition of a suffix? given an example - ANSWERS-all
elements of A occur last in B
<1, 2> --> <8, 14, 1, 2>
what is "s[1, 7) of "s = Go Buckeyes!"" - ANSWERS-"o Buck"
simply put, what is recursion? - ANSWERS-a function that calls itself
what must be done in order for recursion to work? Hint: can I reverse
"Hello" right now? no, so what must I do? - ANSWERS-you must pass a
small subproblem to successive method calls
we keep doing recursive steps until we reach what? what is the
significance of this point that we have reached? - ANSWERS-base case,
it is the smallest subproblem we can solve
what is the basic structure for a recursive method? - ANSWERS-if (base
case condition) {
return some basic value
END OF
PAGE
3