Computer Knowledge
Java Enterprise and Web Technologies
2,279 Questions
Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.
HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts
Java Enterprise and Web Technologies Questions
-
Its a protocol for calling services
-
Its a registry for discovering services
-
Its an xml file for defining the methods that can be called over the web.
-
None of the above
C
Correct answer
Explanation
WSDL (Web Services Description Language) is an XML-based language used to describe the public interface, operations, parameters, and access endpoints of a web service. SOAP is the protocol used to call them, and UDDI is used for discovery.
B
Correct answer
Explanation
This is false. A web service is more than just a function or method exposed on the web. It is a standardized way of integrating web applications using XML, SOAP, WSDL and UDDI open standards over the internet. It involves a complete architecture with protocols for discovery, description, and communication.
-
Open Standard
-
Secure
-
Text Based Response
-
All of Them
A,C
Correct answer
Explanation
Web services are based on open standards (like HTTP and SOAP) and use text-based message formats (like XML or JSON). These features enable cross-platform interoperability, unlike vendor-specific, binary-based native technologies such as EJB, COM/DCOM, or CORBA.
-
A Web service
-
A tool to generate Web services from java classes.
-
A tool to generate web service stubs.
-
All of the above.
B,C
Correct answer
Explanation
Apache Axis is primarily a tool for generating web services from Java classes (B) and for generating web service stubs/proxies (C). While Axis can work with web services (A), describing it as 'a web service' is not its primary definition - it's a framework/tool for creating and consuming web services. Option D 'All of the above' is incorrect because A is misleadingly worded.
-
Web Service Discovery Logic
-
Web Service Dynamic Link
-
Web Service Discovery Latency
-
Web Services Description Language
D
Correct answer
Explanation
WSDL (Web Services Description Language) is an XML-based language that describes the interface, operations, parameters, and location of a web service. It enables clients to understand how to invoke the service. The other options are not standard web service acronyms.
-
J2EE
-
WPF
-
WCF
-
Silverlight
-
ASP.NET
A,C,E
Correct answer
Explanation
J2EE (Java Enterprise Edition) provides comprehensive support for developing web services through JAX-WS and JAX-RS APIs. WCF (Windows Communication Foundation) is Microsoft's unified framework for building service-oriented applications and web services. ASP.NET supports web services through ASMX (legacy) and Web API (modern) technologies. WPF and Silverlight are client-side UI frameworks for desktop and browser-based applications respectively - they consume web services but are not used to build them.
-
Mapping files
-
http.conf
-
XML Configuration hibernate.cfg.xml
-
web.config
A,C
Correct answer
Explanation
Hibernate configuration is typically defined using programmatic mapping files and XML configuration files like hibernate.cfg.xml. Config files like http.conf (Apache Web Server) and web.config (ASP.NET) are completely unrelated to Hibernate.
-
Session is a light weight non-threadsafe object
-
You can share the session between threads
-
Session represents a single unit-of-work with the database
-
Session is the primary interface for the persistence service
-
A session loads database connections using lazy-loading
B
Correct answer
Explanation
Hibernate Session objects are explicitly designed to be non-threadsafe. Each thread should have its own Session instance to prevent race conditions and data corruption. The Session is lightweight but must not be shared across threads.
-
Configuration interface
-
Session interface
-
Query and Criteria interfaces
-
User interface
A,B,C
Correct answer
Explanation
Configuration, Session, Query, and Criteria are core Hibernate interfaces used to establish settings, manage database connections, and run queries. The User interface is not part of Hibernate's core framework APIs.
-
Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier
-
Created during application initialization
-
Wraps a JDBC connection
-
Act as session Factory
C
Correct answer
Explanation
The Hibernate Session interface wraps a JDBC connection and provides methods for CRUD operations. It also holds a first-level cache and is created by SessionFactory (not during application initialization - that's when SessionFactory is created). The Session itself does not act as a factory.
-
DataContractSerializer
-
XMLSerializer
-
DataContractFormatter
-
None of the above
A
Correct answer
Explanation
DataContractSerializer is the default serializer used by WCF to translate .NET objects into XML. XmlSerializer is an alternative that must be explicitly opted into, while DataContractFormatter is not a standard standalone serializer class.
-
[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples", SessionMode=SessionMode.Required)] public interface ICalculator{ [OperationContract] double AddTo(double n); }
-
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class CalculatorService : ICalculator { double result = 0.0D; public double AddTo(double n) { return result+=n; } }
-
a and b both
-
None of the above
C
Correct answer
Explanation
Enabling sessions in WCF requires both: (1) marking the service contract with SessionMode.Required, and (2) setting InstanceContextMode to PerSession in the ServiceBehavior. Option A shows the contract requirement, Option B shows the service behavior - both are necessary.
-
[ServiceContract] interface IStock { [OperationContract] [WebGet] int GetStock(string StockId); }
-
[ServiceContract] interface IStock { [OperationContract] [WebInvoke] int GetStock(string StockId); }
-
a and b
-
None
C
Correct answer
Explanation
WCF REST services are created by adding WebGet (for HTTP GET) or WebInvoke (for other HTTP methods) attributes to operation contracts. Both approaches are valid for creating RESTful services.
-
Use a BasicHttpBinding binding with the security mode set to Message
-
Use a BasicHttpBinding binding with the security mode set to TransportWithMessageCredential
-
Use a WSFederationHttpBinding binding with the security mode set to Message
-
Use a WSFederationHttpBinding binding with the security mode set to TransportWithMessageCredential
C
Correct answer
Explanation
WSFederationHttpBinding with Message security is the correct choice for STS-based token authentication when SSL/TLS is not available. This binding is specifically designed for federated security scenarios where a Security Token Service issues tokens. TransportWithMessageCredential requires SSL transport security, which the scenario explicitly states clients cannot use.