1/10
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
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.
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.
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.
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.
When is sequential search considered efficient?
When there is special knowledge of the problem instance indicating proximity to the best case.
Can sequential search be applied to sorted arrays?
No, it can be applied to non-sorted arrays only.
What method is preferred to check equality between arrays?
Arrays.equals() is the preferred way.
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.
What does the == operator do when comparing arrays?
It only succeeds if an array is compared to itself, as it compares addresses.
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.
What is the cost bound for Binary Search?
Binary Search has a cost bound given by O(log n).