Mixed Deck — All 1Z0-819 Topics Flashcards
100 cards from real 1Z0-819 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 20 Mixed Deck — All 1Z0-819 Topics flashcards as text
What is the purpose of exception handling in Java?
Answer: To handle errors gracefully during runtime
Exception handling in Java provides a structured way to deal with runtime errors, known as exceptions, that disrupt the normal flow of program execution. Its primary purpose is to prevent programs from crashing abruptly and instead allow them to recover gracefully or terminate in a controlled manner, improving robustness. It does not aim to stop execution immediately, increase complexity, or reduce performance, but rather to manage unexpected situations effectively.
What happens when you place a modular JAR on the class path instead of the module path?
Answer: The module-info.class is ignored and the JAR is treated as unnamed module content
When a modular JAR is placed on the class path, `module-info.class` is ignored and its classes become part of the unnamed module.
Which collector creates an unmodifiable list in Java 10+?
Answer: Collectors.toUnmodifiableList()
Collectors.toUnmodifiableList() was introduced in Java 10 and returns an unmodifiable List.
How does the HashMap store data?
Answer: Using key-value pairs
A `HashMap` in Java stores data as a collection of key-value pairs. Each key is unique and maps to a specific value. It uses a hashing mechanism to efficiently store and retrieve these pairs, providing fast average-case performance for operations like `put` and `get`.
What is a checked exception in Java?
Answer: Exceptions that must be declared or handled
A checked exception in Java is an exception that the compiler enforces you to handle. This means that methods throwing checked exceptions must either declare them using the `throws` keyword in their signature or enclose the problematic code within a `try-catch` block. This design ensures that developers explicitly consider and address potential error conditions, making programs more robust.
What is the correct return type of `BiFunction`?
Answer: Boolean
The third type parameter of BiFunction is the return type R, so Boolean is returned.
What is the fundamental principle behind modules system in the 1Z0-819 domain?
Answer: Balancing performance, reliability, and efficiency
Effective technical design requires balancing performance requirements with reliability needs and operational efficiency.
What is the module name for the foundational Java SE module that all other modules implicitly depend on?
Answer: java.base
java.base is the foundational platform module containing java.lang, java.util, java.io, etc., and every module implicitly requires it.
What is the output of: IntStream.of(1,2,3).map(x -> x * x).sum();
Answer: 14
The lambda squares each element (1, 4, 9) and sum() adds them: 1+4+9=14.
In 1Z0-819 practice, what is the best approach to quality improvement in collections framework?
Answer: Use data-driven methods with measurable outcomes
Data-driven quality improvement with measurable outcomes ensures that changes actually produce the intended improvements and can be verified.
Which class provides a thread-safe variant of `HashMap` without synchronizing the entire map?
Answer: ConcurrentHashMap
`ConcurrentHashMap` uses segment-level or bucket-level locking to allow concurrent reads and partial concurrent writes without locking the full map.
What is the output of: `System.out.println(10 / 3);`?
Answer: 3
Integer division truncates the decimal part, so 10 / 3 yields 3.
Which interface does `HashMap` NOT implement?
Answer: SortedMap
`HashMap` implements `Map`, `Cloneable`, and `Serializable`, but NOT `SortedMap` — that is implemented by `TreeMap`.
An annotation processor that generates new source files implements which interface from javax.annotation.processing?
Answer: Processor
javax.annotation.processing.Processor is the interface annotation processors implement; AbstractProcessor provides a convenient base class.
Which access modifier makes a member visible only within its own class?
Answer: private
`private` restricts visibility strictly to the declaring class itself.
When a design constraint conflicts with a stakeholder preference in Oracle Java SE 11 Developer, the BEST approach is to:
Answer: Evaluate both factors, communicate trade-offs, and find an optimal solution
When constraints and preferences conflict, professionals should evaluate both factors objectively, clearly communicate the trade-offs to stakeholders, and work collaboratively to find a solution that best balances both considerations.
What does Collectors.summarizingInt(ToIntFunction) produce?
Answer: An IntSummaryStatistics object
summarizingInt() collects count, sum, min, max, and average into an IntSummaryStatistics instance.
What tool is used to package compiled modules?
Answer: jar
The `jar` tool is the standard utility in Java for packaging compiled Java classes, resources, and metadata into a single archive file. For modules, `jar` is used to create a modular JAR file, which includes the compiled `module-info.class` file at its root, making it a deployable unit for the Java Platform Module System.
What is the effect of compiling a module with `javac --release 11 --module-source-path src -m com.example`?
Answer: Compiles the com.example module and its sources from the directory matching its name under src/
`-m com.example` with `--module-source-path` tells `javac` to compile the named module, looking for its sources in the `src/com.example/` subtree.
When using a lambda to implement an interface with a throws clause on the abstract method, what must the lambda body do?
Answer: Handle or propagate only checked exceptions declared by the functional interface method
The lambda body can throw checked exceptions only if the functional interface's abstract method declares them; otherwise only unchecked exceptions are permitted.