Final Flashcards

1
Q

er one complete pass through the array the largest value in the array will end up in the _____element. (T!)

A

last

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how many comparisons of values are made in one pass of a bubble sort? (T!)

A

number of comparisons is (array.length – 1)…one less than the number of elements. If there are 5 elements, we make (5-1) or 4 comparisons. (T!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

how many passes do you have to make in a bubble sort to completely sort an array of ‘n’ elements? (T!)

A

Number of passes to completely sort an array of ‘n’ elements is equal to ‘n-1’. (T!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

bigest problem with basic bubble sort :

A

it processes the same number of elements on each pass. (T!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

each pass results in one less element to look at during the next pass. (T!)

A

yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can a method call itself?

A

yes recursive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Characteristics of recursion(T!)

A

All problems/solutions involving recursion have the following characteristics:

1) One or more base cases (AKA stopping cases) are used to stop the method from making a recursive call.
2) For fibonacci, the two base cases are when n=1 or n=0…if n=1 we return 1, or if n = 0 we return a zero. In all other cases we call the method recursively.
3) Every recursive call reduces the original problem one step closer to the base case(s)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When a method that returns a value is called, it is placed on the memory area called _______ (T!)

A

the method call stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

anu path string that begins with ______ or root prefix is known as an ABSOLUTE path (T!), i.e: “C:\Temp2\notes.txt”

A

a drive letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Confessing using a throws clause will let your program compile properly, but it gives no protection if the exception is actually thrown. Your program will ____ . (T!)

A

crash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

benefit of a class method…

A

YOU DO NOT HAVE TO CREATE AN OBJECT OF THE CLASS IN WHICH THE METHOD IS DEFINED IN ORDER TO CALL THE METHOD. (

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ample of a class method we have recently used is the Math.random() method for generating random numbers. 

A

To call this method, we use the ClassName.methodName() syntax (T!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

a offers a shortcut way to declare, create and populate an array all at once by enclosing the data values inside curly braces. (T!)

A

ng [ ] monthsArray = {“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”, ”Nov”,”Dec”}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

ArrayList is not restricted to holding values of just one data type like an array.

A

t is heterogeneous, because it holds the references to the memory addresses of objects rather than the objects themselves. (T!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly