This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “Getting Started with OSGi”.
1. OSGi—which was formerly known as the:-
a) Open Services Gateway initiative
b) Open Source Gateway initiative
c) Open Services Gateway initialisation
d) None of the mentioned
View Answer
Explanation: OSGi—which was formerly known as the Open Services Gateway initiative, though the name’s obsolete now—has its roots in the embedded space, where dynamic service provisioning is far more important than it is in the gridiron world of enterprise applications.
2. OSGi provides a layer on top of the JVM’s default class loader.
a) True
b) False
View Answer
Explanation: The deployment unit for OSGi is a bundle, which is essentially a JAR with an augmented MANIFEST.MF.
3. On top of Spring Dynamic Modules, SpringSource built SpringSource dm Server, which is a server wired from top to bottom with OSGi and Spring.
a) True
b) False
View Answer
Explanation: SpringSource dm Server supports dynamic deployment, enhanced tooling, HTTP, and native .war deployment.
4. OSGi is a framework.
a) True
b) False
View Answer
Explanation: OSGi is a specification, not a framework. There are many implementations of the specification, just as there are many implementations of the Java EE specification.
5. User component models are:-
a) OSGi
b) Spring
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: OSGi is not a user component model, like Spring or EJB 3. Instead, it sits below your components, providing life-cycle management for Java classes.
6. In OSGi, anything used by something else is a state.
a) True
b) False
View Answer
Explanation: In OSGi, anything used by something else is a service. “Service” doesn’t imply any concrete inheritance.
7. “Service” doesn’t imply any:-
a) RPC
b) inheritance
c) transactional qualities
d) all of the mentioned
View Answer
Explanation: “Service” doesn’t imply any concrete inheritance; it doesn’t imply transactional qualities, and it doesn’t imply RPC. It’s merely a class on whose concrete, black-box functionality and interface your class relies.
8. OSGi bundles are simply standard .jar files with customized MANIFESTs that OSGi consumes at runtime.
a) True
b) False
View Answer
Explanation: The plug-in wraps the bnd command line tool.
9. Tool which dynamically interrogates classes for their imports and generates OSGi–compliant entries.
a) pnd
b) jndi
c) bnd
d) none of the mentioned
View Answer
Explanation: We repeat it here mainly for illustrative purposes.
10. The plug-in produces OSGi–compliant bundles that work in any container.
a) True
b) False
View Answer
Explanation: To read more on the plug-in itself, see http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html.
11. The Bundle-Activator directive describes to the OSGi environment, which class implements :-
a) BundleActivator
b) BundleActivate
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: The Bundle-Activator directive describes to the OSGi environment, which class implements BundleActivator, and should be consulted when life cycle events occur.
12. When the bundle begins to load and start, it calls the start method of the:-
a) BundleActivator
b) Activator
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: When the bundle begins to load and start, it calls the start method of the Activator.
13. To start using Spring to smooth over some of the minutiae of resource acquisition and to help build more reliable systems in an OSGi environment.
a) Spring DM server
b) Spring Dynamic Modules
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: Use Spring Dynamic Modules to provide the integration. Spring Dynamic Modules is a framework on top of OSGi that works with any OSGi environment.
14. Spring Dynamic Modules scans our deployed bundles and loads an ApplicationContext (actually, the specific type of the ApplicationContext is OsgiBundleXmlApplicationContext) into memory based on an event, or a trigger.
a) True
b) False
View Answer
Explanation: There are two ways to trigger this behavior. The first is to explicitly specify in the META-INF/MANIFEST.MF file the attribute Spring-Context, which allows you to override the default location it consults. Otherwise, by default, Spring Dynamic Modules will look for the XML file in the META-INF/spring directory of a bundle.
15. You’ll split your OSGi–specific Spring configuration and your plain-vanilla Spring configuration into:-
a) modulename-context.xml
b) modulename-osgi-context.xml
c) all of the mentioned
d) none of the mentioned
View Answer
Explanation: Typically, you’ll split your OSGi–specific Spring configuration and your plain-vanilla Spring configuration into two different files, of the form: modulename-context.xml and modulename-osgi-context.xml.
Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Apply for Programming Internship
- Check Information Technology Books
- Check Spring Books
- Practice Programming MCQs