Java Archives - Quiz - Explanation
The correct answers are indicated below, along with text that explains the correct answers.
1.
The primary purpose of JAR files in relation to JavaBeans is to:
A.
Provide a means of compressing Bean resources.
B.
Serve as a standard format for distributing Beans.
C.
Support digital signatures.
The correct answer is B.
JAR files are important to JavaBeans because they serve as a standard format for distributing Beans.
A is incorrect because even though compression can be useful for Beans that are published on the Web, the primary importance of JAR files is as a distribution format for Beans. C is incorrect for similar reasons since digital signatures can be useful for Beans with security concerns.
2.
What informational file is required for a JAR file to adequately house a Bean?
A.
A header file.
B.
A make file.
C.
A manifest file.
The correct answer is C.
A manifest file is the informational file required for a JAR file to adequately house a Bean. A and B are incorrect because header files and make files have nothing to do with packaging Beans in JAR files; header files are used to define classes in programming languages such as C++, while make files are used to outline build information for some compilers.
3.
When packaging a JavaBean in a JAR file, which manifest attribute explicitly identifies a class as a JavaBean component?
Please select
the best answer
.
A.
Bean-Class: True
B.
Java-Bean: True
C.
Component-Type: Bean
The correct answer is B.
The Java-Bean: True attribute in the manifest file explicitly marks a class as a JavaBean component. This attribute is placed in the per-entry section of the manifest for each class file that represents a Bean, allowing development tools and containers to identify which classes in the JAR are intended to be used as JavaBeans. A is incorrect because Bean-Class is not a valid manifest attribute for identifying JavaBeans. C is incorrect because Component-Type is not a standard manifest attribute used in JavaBean packaging.