What is a Java array?
An array is an ordered, fixed-size sequence whose elements all have the same type. Java arrays are objects.
Study 07 Arrays and Collections with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is a Java array?
An array is an ordered, fixed-size sequence whose elements all have the same type. Java arrays are objects.
What is the valid index range of a Java array?
Java arrays use zero-based indexing: the first index is 0, and the last valid index is `array.length - 1`.
What is the difference between declaring and creating an array?
A declaration creates a variable that can refer to an array; `new` creates the array object with a specified length.
How do you obtain a Java array's length?
Use the field `array.length`, not the method call `array.length()`, to obtain an array's length.
How do you update one element of an array?
Assign a new value through its index, such as `scores[2] = 80;`. The assignment changes that existing element.
Why should an array loop use `i < array.length`?
An indexed loop should continue while `i < array.length`. Using `<=` attempts to access the invalid index `array.length`.
When is a for-each loop appropriate for an array?
Use a for-each loop when you need each value but not its index. Changing its loop variable does not replace elements in the array.
What is a linear search?
A linear search checks elements from beginning to end and works whether or not the array is sorted. Its worst-case running time is O(n).
What condition does binary search require?
Binary search repeatedly halves the search range and typically runs in O(log n), but the searched array must already be sorted.
Why cast an array sum to `double` when computing an average?
Cast the sum to `double` before division, for example `(double) sum / scores.length`, so integer division does not discard the fractional part.
How should minimum and maximum computations be initialized?
Initialize both values from the first element, such as `values[0]`, then compare the remaining elements. This requires a nonempty array.
How can you preserve an array before modifying it?
Arrays are mutable: a method can change the caller's array object. Use `Arrays.copyOf` first when the original values must be preserved.
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.