Quiz Methods & Arrays Preparation

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/10

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

11 Terms

1
New cards

What types of method parameters cannot be used to return results?

Method parameters of primitive types like int, double, char, and immutable non-primitive types like String.

2
New cards

What can parameters of mutable non-primitive types be used for?

They can be used to return results as changes in the parameter’s content.

3
New cards

What happens to memory allocated to non-static local variables after a method terminates?

The memory is de-allocated since they are on the stack.

4
New cards

Where are static local variables and members allocated?

They are allocated in global memory, outside stack and heap, and are available for the whole program execution.

5
New cards

When is sequential search considered efficient?

When there is special knowledge of the problem instance indicating proximity to the best case.

6
New cards

Can sequential search be applied to sorted arrays?

No, it can be applied to non-sorted arrays only.

7
New cards

What method is preferred to check equality between arrays?

Arrays.equals() is the preferred way.

8
New cards

What is the purpose of System.arraycopy()?

It is an optimized method to shallow-copy a range of items between two arrays of the same type.

9
New cards

What does the == operator do when comparing arrays?

It only succeeds if an array is compared to itself, as it compares addresses.

10
New cards

How does the average case cost of sequential search compare to the worst case for binary search?

The average case cost of sequential search is generally worse than the worst case for binary search.

11
New cards

What is the cost bound for Binary Search?

Binary Search has a cost bound given by O(log n).