J2EE & XML Interview Questions in Java

List of topic-wise frequently asked java interview questions with the best possible answers for job interviews.

J2EE & XML Interview Questions in Java

Question 1.
What is J2EE?
Answer:
J2EE is a standard for building enterprise applications. It includes technologies for implementing business logic, database access, message exchange, transaction management, web requests processing, and many other features. The main approach of J2EE is separating presentation level from business logic (lightweight client applications) and business logic from data storage (application level of n-tier architecture).
J2EE is an environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, web-based applications.

Question 2.
Are J2EE applications portable and scalable?
Answer:
Nowadays industry requires portable and scalable information systems to stay in touch with the rapidly changing world. J2EE applications proved the right to be called portable, because of the platform independence of Java. J2EE applications can be developed at home and deployed to a multiprocessor server cluster. Object-oriented approach for application design makes applications scalable and easy to maintain.

Question 3.
What makes J2EE suitable for distributed multitiered Applications?
Answer:
The J2EE platform uses a multitiered distributed application model. Application logic is divided into components according to function, and the various application components that make up a J2EE application are installed on different machines depending on the tier in the multitiered J2EE environment to which the application component belongs. The J2EE application parts are:

  • Client-tier components run on the client machine.
  • Web-tier components run on the J2EE server.
  • Business-tier components run on the J2EE server.
  • Enterprise information system (ElS)-tier software runs on the EIS server.

Question 4.
What are the components of the J2EE application?
Answer:
A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:

  1. Application clients and applets are client components.
  2. Java Servlet and JavaServer Pages technology components are web components.
  3. Enterprise JavaBeans components (enterprise beans) are business components.
  4. Resource adapter components provided by EIS and tool vendors.

Question 5.
What do Enterprise JavaBeans components contain?
Answer:
Enterprise JavaBeans components contain Business code, which is logic that solves or meets the needs of a particular business domain such as banking, retail, or finance, is handled by enterprise beans running in the business tier. All . the business code is contained inside an Enterprise Bean which receives data from client programs, processes it (if necessary), and sends it to the enterprise information system tier for storage. An enterprise bean also retrieves data from storage, processes it (if necessary), and sends it back to the client program.

Question 6.
Is the J2EE application only web-based?
Answer:
No, It depends on the type of application that client wants. A J2EE application can be web-based or non-web-based, if an application client executes on the client machine, it is a non-web-based J2EE application. The J2EE application can provide a way for users to handle tasks such as the J2EE system or application administration. It typically has a graphical user interface created from Swing or AWT APIs, or a command-line interface. When a user requests, it can open an HTTP connection to establish communication with a servlet running in the web tier.

Question 7.
Are JavaBeans J2EE components?
Answer:
No. JavaBeans, components are not considered J2EE components by the J2EE specification. They are written to manage the data flow between an application client or applet and components running on the J2EE server or between server components and a database. JavaBeans components written for the J2EE platform have instance variables and get and set methods for accessing the data in the instance variables. JavaBeans components used in this way are typically simple in design and implementation but should conform to the naming and design conventions outlined in the JavaBeans component architecture.

Question 8.
Is an HTML page a web component?
Answer: No. Static HTML pages and applets are bundled with web components during application assembly but are not considered web components by the J2EE specification. Even the server-side utility classes are not considered web components, either.

Question 9.
What can be considered as a web component?
Answer:
J2EE Web components can be either servlets or JSP pages. Servlets are Java programming language classes that dynamically process requests and construct responses. JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content.

Question 10.
What is the container?
Answer:
Containers are the interface between a component and the low-level platform-specific functionality that supports the component. Before a Web, enterprise bean, or application client component can be executed, it must be assembled into a J2EE application and deployed into its container.

Question 11.
What are container services?
Answer:
A container is a runtime support of a system-level entity. Containers provide components with services such as lifecycle management, security, deployment, and threading.

Question 12.
What is the web container?
Answer:
Servlet and JSP containers are collectively referred to as Web containers. It manages the execution of the JSP page and servlet components for J2EE applications. Web components and their container run on the J2EE server.

Question 13.
What is Enterprise JavaBeans (EJB) container?
Answer:
It manages the execution of enterprise beans for J2EE applications. Enterprise beans and their container run on the J2EE server.

Question 14.
What is an Applet container?
Answer:
manages the execution of applets. Consists of a Web browser and Java Plugin running on the client together.

Question 15.
How do we package J2EE components?
Answer:
J2EE components are packaged separately and bundled into a J2EE application for deployment. Each component, its related files such as GIF and HTML files or server-side utility classes, and a deployment descriptor are assembled into a module and added to the J2EE application. A J2EE application is composed of one or more enterprise bean, Web, or application client component modules. The final enterprise solution can use one J2EE application or be made up of two or more J2EE applications, depending on design requirements. A J2EE application and each of its modules have their own deployment descriptor. A deployment descriptor is an XML document with a .xml extension that describes a component’s deployment settings.

Question 16.
What is the life cycle (J2EE component)?
Answer:
The framework events of a J2EE component’s existence. Each type of component has to define events that mark its transition into states in which it has varying availability for use. For example, a servlet is created and has its init method called by its container before the invocation of its service method by clients or other servlets that require its functionality. After the call of its init method, it has the data and readiness for its intended use. The servlet’s destroy method is called by its container before the ending of its existence so that processing associated with winding up can be done and resources can be released.

The init and destroy methods in this example are callback methods. Similar considerations apply to the life cycle of all J2EE component types: enterprise beans, Web components (servlets or JSP pages), applets, and application clients.

Question 17.
What is a thin client?
Answer:
A thin client is a lightweight interface to the application that does not have such operations as query databases, execute complex business rules, or connect to legacy applications.

Question 18.
What are the types of J2EE clients?
Answer:
Following are the types of J2EE clients:

  • Applets
  • Application clients
  • Java Web Start-enabled rich clients, powered by Java Web Start technology.
  • Wireless clients, based on Mobile Information Device Profile (MIDP) technology.

Question 19.
What is a deployment descriptor?
Answer:
A deployment descriptor is an Extensible Markup Language (XML) text-based file with a .xml extension that describes a component’s deployment settings. A J2EE application and each of its modules have their own deployment descriptor. For example, an enterprise bean module deployment descriptor declares transaction attributes and security authorizations for an enterprise bean. Because deployment descriptor information is declarative, it can be changed without modifying the bean source code. At the run time; the J2EE server reads the deployment descriptor and acts upon the component accordingly.

Question 20.
What is the EAR file?
Answer:
An EAR file is a standard JAR file with a .ear extension, named from the Enterprise ARchive file. A J2EE application with all of its modules is delivered in an EAR file.

Question 21.
What are JTA and JTS?
Answer:
JTA is the abbreviation for the Java Transaction API. JTS is the abbreviation for the Jave Transaction Service. JTA provides a standard interface and allows you to demarcate transactions in a manner that is independent of the transaction manager implementation. The J2EE SDK implements the transaction manager with JTS. But your code doesn’t call the JTS methods directly.

Instead, it invokes the JTA methods, which then call the lower-level JTS routines. Therefore, JTA is a high-level transaction interface that your application uses to control transactions, and JTS is a low-level transaction interface and ejb uses behind the scenes (client code doesn’t directly interact with JTS. It is based on object transaction service(OTS) which is part of CORBA.

Question 22.
What is JAXP?
Answer:
JAXP stands for Java API for XML. XML is a language for representing and describing text-based data which can be read and handled by any program or tool that uses XML APIs. It provides standard services to determine the type of an arbitrary piece of data, encapsulates access to it, discovers the operations available on it, and creates the appropriate JavaBeans component to perform those operations.

Question 23.
What is J2EE Connector?
Answer:
The J2EE Connector API is used by J2EE tools vendors and system integrators to create resource adapters that support access to enterprise information systems that can be plugged into any J2EE product. Each type of database or EIS has a different resource adapter. Note: A resource adapter is a software component that allows J2EE application components to access and interact with the underlying resource manager. Because a resource adapter is specific to its resource manager, there is typically a different resource adapter for each type of database or enterprise information system.

Question 24.
What is JAAP?
Answer:
The Java Authentication and Authorization Service (JAAS) provide a way for a J2EE application to authenticate and authorize a specific user or group of users to run it. It is a standard Pluggable Authentication Module (PAM) framework that extends the Java 2 platform security architecture to support user-based authorization.

Question 25.
What is Java Naming and Directory Service?
Answer:
The JNDI provides naming and directory functionality. It provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. Using JNDI, a J2EE application can store and retrieve any type of named Java object. Because JNDI is independent of any specific implementations, applications can use JNDI to access multiple naming and directory services, including existing naming and directory services such as LDAP, NDS, DNS, and NIS.

Question 26.
What is the J2EE application?
Answer:
Any deployable unit of J2EE functionality. This can be a single J2EE module or a group of modules packaged into an EAR file along with a J2EE application deployment descriptor. J2EE applications are typically engineered to be distributed across multiple computing tiers.

Question 27.
What is the J2EE component?
Answer:
A self-contained functional software unit supported by a container and configurable at deployment time. The J2EE specification defines the following J2EE components: Application clients and applets are components that run on the client. Java servlet and JavaServer Pages (JSP) technology components are Web components that run on the server.

Enterprise JavaBeans (E JB) components (enterprise beans) are business components that run on the server. J2EE components are written in the Java programming language and are compiled in the same way as any program in the language. The difference between J2EE components and “standard” Java classes is that J2EE components are assembled into a J2EE application, verified to be well-formed and in compliance with the J2EE specification, and deployed to production, where they are run and managed by the J2EE server or client container.

Question 28.
What is the J2EE module?
Answer:
A software unit that consists of one or more J2EE components of the same container type and one deployment descriptor of that type. There are four types of modules: EJB, Web, application client, and resource adapter. Modules can be deployed as stand-alone units or can be assembled into a J2EE application.

Question 29.
What is the J2EE product?
Answer:
An implementation that conforms to the J2EE platform specification.

Question 30.
What is a J2EE product provider?
Answer:
A vendor that supplies a J2EE product.

Question 31.
What is the J2EE server?
Answer:
The runtime portion of a J2EE product. A J2EE server provides EJB or Web containers or both.
Question 32.
Explain J2EE architecture.
Answer:
The JEE platform provides the environment to develop enterprise applications/services using multitier architecture. The highly intensified technology made the need for scalable, efficient, faster solutions for information management. The JEE technology is rightly apt for meeting these requirements. JEE provides a programming development environment that improves the productivity of development, standards for hosting/deploying enterprise applications. The following are the tiers in JEE application
Client Tier: The client tier includes the web components such as Servlets, JSP, or standalone Java desktop applications. This tier provides dynamic interfaces to the middle tier.
• Middle Tier: This is also called the server tier. In the middle tier, enterprise beans and web services encapsulate distributable business logic for the applications which are reusable. The JEE application server contains the server-tier components which provide the platform for these web components for actions to be performed and data to be stored/persisted.
• Enterprise data tier: The enterprise-level data is stored/persisted preferably or typically in a relational database, in this tier.
The JEE applications comprise components, containers, and services. All the web components (Servlets, JSP) provide dynamic requests and responses from a web page. The EJB components contain the server-side business logic for enterprise applications.
Question 33.
J2EE is a container-centric architecture. Explain.
Answer:
A container acts as an interface between a platform-specific functionality and a component. The component must be assembled before a web or enterprise bean or application client component execution, into a JEE application and deployed into its container.
The settings of a container can be customized for underlying support provided by the JEE server. These include security, transaction management, and Java Naming and Directory Interface lookups.
The management of nonconfigurable services such as servlet life cycle, enterprise bean life cycle, database connection, data persistence, database connection pooling also can be done by the container.
Question 34.
Explain the four types of containers that the J2EE specification defines.
Answer:
A container is a runtime support of a system-level entity [Applet, Servlet/ JSP, EJB] The four types of containers that the J2EE specification defines are applet container, application-client container, web container, and EJB container.
Applet Container: An applet is a java program that can be embedded into a web page. Most of the web pages are authored in HTML. To use an applet in HTML document, the tags <APPLET> and </APPLET> are used. They are used to indicate to the browser that a java applet should be loaded. “These tags act as a container for the java applet definition. “ Applet container manages the execution of applet and contains the web browser.
Application-client Container: The Application Client Container (ACC) is a combination of Java classes, libraries, and other files. They are used to distribute along with Java client programs that execute on their own JVM. The execution of the application client components is managed by the application-client container. The ACC can take the responsibility to collect user name and password which is treated as authentication data.
Web Container: A web container is a part of the webserver. It provides the run time environment to execute a web application such as a servlet, JSP. A servlet container translates the URL requests into servlet requests. The JSP implicit objects such as request, response, out, page, pageContext, etc., are exposed by the JSP container.
EJB Container: The EJB container, like other containers, provides a run-time environment to execute EJB components such as enterprise beans. An EJB container manages transactions, state management details, multi-threading, connection pooling. The applications are provided with security using an EJB container. All database access required by the entity bean will be handled by the EJB container.
Question 35.
Explain the J2EE container architecture.
Answer:
J2EE Container Architecture:
The J2EE application components need support at runtime. This support is provided by J2EE containers. They use protocols, methods of the containers to access other application components. The containers of J2EE are 1) Web container 2) EJB container.
1) The web container is used to host web applications. It provides the run time environment to execute Servlet and JSP component types.
2) The business logic is dealt with by the server components called EJB components. Access to local and remote enterprise beans is provided by the EJB container. The operations of the three beans namely Entity Bean, Session Bean, and Message-driven bean are handled by the EJB Container.
Question 36.
Explain the technologies that the J2EE platform provides for developing components.
Answer:
1) Servlet Technology: It is considered the foundation of web technologies. It overcomes the limitations of CGI technology. It is a server-side component to serve the clients and generate dynamic content. Servlets interacts with web clients using the paradigm request-response. All client requests are sent through web servers to the servlet container. The servlet then processes the request and sends the response back to the client. Servlets are reliable, scalable, efficient, and reusable server-side components.
2) JSP Technology: It is the extension of servlet technology. It is easy to author JSP without much knowledge of the supporting API. JSP can be used to work with HTTP requests and HTTP responses, session management, and so on. It is easy to combine both static and dynamic content with JSP. The factor to develop JSP technology is to use regular HTML tags. The JSP author can place servlet or simple java code on the page by using specially designated tags. The entire JSP will be translated into Servlet and the servlet-related code is communicated to the container to run.
3) EJB Technology: EJB is a server-side web component. It depends on other Java technologies for proper functionality such as Remote Method Invocation. RMI is used as a protocol between 2 enterprise beans and between an enterprise bean and its client. EJB encapsulates the business logic. All EJBs are developed, deployed, and run only in an EJB container. This is similar to servlets and JSP run in a web container.
EJB applications are easy to develop because the applications developer can concentrate on business logic. The developer can utilize the services provided by the EJB container, like connection pooling and transactions.
Question 37.
Explain the J2EE APIs, i.e. RMI/IIOP, JNDI, JDBC, Java Mail, and JMS.
Answer:
RMI/IIOP: RMI stands for Remote Method Invocation. HOP stands for Inter Internet-ORB Protocol. ORB
RMI/IIOP API is used to write distributed objects using Java technology, which enables the communication between objects in the memory, across JVM and also physical devices.
RMI/IIOP yields the benefits of OOP such as inheritance, polymorphism, and encapsulation and is platform-independent. In RMI/IIOP, the code related to network is written by applying the interface but not the implementations. The operation can solely be on the interface of that object’s class.
RMI-IIOP relies on object serialization for passing parameters via remote method invocations.
JNDI (Java Naming and Directory Interface) API: To enable java programs to access the naming and directory services, the JNDI API is utilized. Naming services emphasize on the services that are to associate names with objects.
We are familiar with naming systems such as the file system which has a directory or path associated it. Surfing web is associated with a name that is the URL called Domain Naming System. EJB components of a J2EE application server, user profiles are associated in LDAP (Lightweight Directory Access Protocol) directory.
For example, JNDI is the best API to write a java application that is used for search utility over network-enabled desktop, class-browser, or an address book search utility.
JDBC (Java Database Connectivity) API: Many java applications use a database and database accessing and programming is a significant role in web application development. JDBC is an API that enables the accessibility to a database in order to manipulate the database.
The JDBC API supports both two-tier and three-tier models for database access. Two-tier model – a Java application interacts directly with the database. Three-tier model – introduces a middle-level server for execution of business logic: the middle tier to maintain control over data access.
The application that uses the JDBC implements the following sequence.
  1. Importing Packages
  2. Registering the JDBC Drivers
  3. Opening a Connection to a Database
  4. Creating a Statement Object
  5. Executing a query and Returning a Result Set Object
  6. Processing the Result Set
  7. Closing the Result Set and Statement Objects
  8. Closing the Connection.
Java Mail API: Mailing and Messaging applications can be modeled or developed using Java Mail. The e-mail messaging applications can be developed for both high-level implementation and low-level implementation. That is, a small company that is heading towards growth can develop solutions which ensure the accessing to their mail server in an efficient manner. A blue-chip company can focus on providing the access to industry-level access which is a wider reach and provides vast support. JMS: Java Message Services is an API that enables the components of an application, could it be JSE or JEE component to provide messaging services such as create, send, receive and read messages. Using loosely coupled, reliable and asynchronous communications are enabled by JMS.
The JMS application contains the following parts:
1. JMS Provider: It implements the JMS interface and provides the administration and control services for the messages. J2EE 1.3 includes the JMS Provider service.
2. JMS Clients: These are the java applications that produce or consume the messages.
3. Messages: These are the objects that communicate the messages between clients.
4. Administered Objects: They are the JMS objects created by the administrator that can be used by the clients. They are namely destinations and connection factories.
5. Native Clients: These are the applications that use the message client’s native client API instead of JMS API.
Question 38.
What are the 3 different Java platform editions? Explain them.
Answer:
Java 2 Platform, Standard Edition (J2SE)
Java 2 Platform, Enterprise Edition (J2EE)
Java 2 Platform, Micro Edition (J2ME)
Java 2 Platform, Standard Edition (JSE): J2SE is used to develop stand-alone/desktop portable java applications. J2SE consists of two components. Core component and desktop component. Core component provides back-end functionality. The desktop component provides GUI functionality. J2SE consists of Java Development Kit and Java Runtime Environment. JDK consists of a java compiler and other related tools to enable the users to create Java Applications. Java RuntimeJEnyironment consists of a java virtual machine, libraries, and all other components that are necessary to run a java application.
Java 2 Platform, Enterprise Edition (JEE): J2EE is a platform to develop multi¬tier enterprise applications. JEE includes Servlets API, Java Server Pages, and Enterprise Java Beans. It was built on J2SE technology.
Java 2 Platform, Micro Edition (JME): JME is the technology for microelectronic devices like PDAs, Mobile phones, etc. JME supports the flexibility for user interfaces, provides security, and uses the built-in network protocols for networked applications.JME applications can be ported across different devices.
Question 39.
What are the components of the J2EE application?
Answer:
A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:
Application clients and applets are client components. Java Servlet and JavaServer PagesTM (JSPTM) technology components are web components. Enterprise JavaBeansTM (EJBTM) components (enterprise beans) are business components. Resource adapter components provided by EIS and tool vendors.
Question 40.
What are the four types of J2EE modules?
Answer:
  1. Application client module
  2. Web module
  3. Enterprise JavaBeans module
  4. Resource adapter module
Question 41.
What does the application client module contain?
Answer:
The application client module contains:

• class files,
• an application client deployment descriptor.

Application client modules are packaged as JAR files with a .jar extension.
Question 42.
What does the web module contain?
Answer:
The web module contains:
  • JSP files,
  • class files for servlets,
  • GIF and HTML files, and
  • a Web deployment descriptor.

Web modules are packaged as JAR files with a .war (Web ARchive) extension.

Question 43.
What are the differences between Ear, Jar, and War files? Under what circumstances should we use each one?
Answer:
There are no structural differences between the files; they are all archived using zip-jar compression. However, they are intended for different purposes.

• Jar files (files with a .jar extension) are intended to hold generic libraries of Java classes, resources, auxiliary files, etc.
• War files (files with a .war extension) are intended to contain complete Web applications. In this context, a Web application is defined as a single group of files, classes, resources, .jar files that can be packaged and accessed as one servlet context.
• Ear files (files with a .ear extension) are intended to contain complete enterprise applications. In this context, an enterprise application is defined as a collection of .jar files, resources, classes, and multiple Web applications.
Each type of file (.jar, .war, .ear) is processed uniquely by application servers, servlet containers, EJB containers, etc.

Question 44
What is “application client”?
Answer:
A first-tier J2EE client component that executes in its own Java virtual machine. Application clients have access to some J2EE platform APIs.

Question 45.
What is an “application client container”?
Answer:
A container that supports application client components.

Question 46.
What is an “application client module”?
Answer:
A software unit that consists of one or more classes and an application client deployment descriptor.

Question 47.
What is an “application component provider”?
Answer:
A vendor that provides the Java classes that implement components’ methods, JSP page definitions, and any required deployment descriptors.

Question 48.
What is an “application configuration resource file”?
Answer:
An XML file is used to configure resources for a Java Server Faces application, to define navigation rules for the application, and to register converters, Validator, listeners, renders, and components with the application.

Question 49.
What is “archiving”?
Answer:
The process of saving the state of an object and restoring it.

Question 50.
What is “ascent”?
Answer:
A Java-based build tool that can be extended using Java classes. The configuration files are XML-based, calling out a target tree where various tasks get executed.

Question 51.
What is URI?
Answer:
Uniform resource identifier. A globally unique identifier for an abstract or physical resource. A URL is a kind of URI that specifies the retrieval protocol (HTTP or https for Web applications) and the physical location of a resource (hostname and host-relative path). A URN is another type of URI.

Question 52.
What is a URL?
Answer:
Uniform resource locator. A standard for writing a textual reference to an arbitrary piece of data in the World Wide Web. A URL looks like this: protocol://host/ local info where protocol specifies a protocol for fetching the object (such as http or ftp), host specifies the Internet name of the targeted host, and local info is a string (often a file name) passed to the protocol handler on the remote host.

Question 53.
What is a URL path?
Answer:
The part of a URL passed by an HTTP request to invoke a servlet. A URL path consists of the context path + servlet path + path info, where Context path is the path prefix associated with a servlet context of which the servlet is a part. If this context is the default context rooted at the base of the Web server’s URL namespace, the path prefix will be an empty string. Otherwise, the path prefix starts with a / character but does not end with a / character. Servlet path is the path section that directly corresponds to the mapping that activated this request. This path starts with a / character. Path info is the part of the request path that is not part of the context path or the servlet path

Question 54.
What is URN?
Answer:
Uniform resource name. A unique identifier that identifies an entity but doesn’t tell where it is located. A system can use a URN to look up an entity locally before trying to find it on the Web. It also allows the Web location to change, while still allowing the entity to be found.

Question 55.
What is Web application?
Answer:
An application is written for the Internet, including those built with Java technologies such as JavaServer Pages and servlets, as well as those built with non-Java technologies such as CGI and Perl.

Question 56.
What is a Web application, distributable?
Answer:
A Web application that uses J2EE technology written so that it can be deployed in a Web container distributed across multiple Java virtual machines running on the same host or different hosts. The deployment descriptor for such an application uses the distributable element.

Question 57.
What is Web component?
Answer:
A component that provides services in response to requests; either a servlet or a JSP page.

Question 58.
What is Web container?
Answer:
A container that implements the Web component contract of the J2EE architecture. This contract specifies a runtime environment for Web components that includes security, concurrency, life-cycle management, transaction, deployment, and other services. A Web container provides the same services as a JSP container as well as a federated view of the J2EE platform APIs. A Web container is provided by a Web or J2EE server.

Question 59.
What is a Web container, distributed?
Answer:
A Web container that can run a Web application that is tagged as distributable and that executes across multiple Java virtual machines running on the same host or on different hosts.

Question 60.
What is Web container provider?
Answer:
A vendor that supplies a Web container.

Question 61.
What is a Web module?
Answer:
A deployable unit that consists of one or more Web components, other resources, and a Web application deployment descriptor contained in a hierarchy of directories and files in a standard Web application format.

Question 62.
What is Web resource?
Answer:
A static or dynamic object contained in a Web application that can be referenced by a URL.

Question 63.
What is Web resource collection?
Answer:
A list of URL patterns and HTTP methods that describe a set of Web resources to be protected.

Question 64.
What is a Web server?
Answer:
Software that provides services to access the Internet, an intranet, or an extranet. A Web server hosts Web sites, provides support for HTTP and other protocols, and executes server-side programs (such as CGI scripts or servlets) that perform certain functions. In the J2EE architecture, a Web server provides services to a Web container. For example, a Web container typically relies on a Web server to provide HTTP message handling. The J2EE architecture assumes that a Web container is hosted by a Web server from the same vendor, so it does not specify the contract between these two entities. A Web server can host one or more Web containers.

Question 65.
What is Web server provider?
Answer:
A vendor that supplies a Web server.

Question 66.
What is the life cycle (J2EE component)?
Answer:
The framework events of a J2EE component’s existence. Each type of component has to define events that mark its transition into states in which it has varying availability for use. For example, a servlet is created and has its init method called by its container before invocation of its service method by clients or other servlets that require its functionality.

After the call of its init method, it has the data and readiness for its intended use. The servlet’s destroy method is called by its container before the ending of its existence so that processing associated with winding up can be done and resources can be released. The init and destroy methods in this example are callback methods. Similar considerations apply to the life cycle of all J2EE component types: enterprise beans, Web components (servlets or JSP pages), applets, and application clients.

Question 67.
What is life cycle (JavaServer Faces)?
Answer:
A set of phases during which a request for a page is received, a UI component tree representing the page is processed, and a response is produced. During the phases of the life cycle:

The local data of the components are updated with the values contained in the request parameters. Events generated by the components are processed. Validators and converters registered on the components are processed. The components’ local data is updated to back-end objects. The response is rendered to the client while the component state of the response is saved on the server for future requests.

Question 68.
What is Entity Bean and Session Bean?
Answer:
A session bean is a non-persistent object that implements some business logic running on the server. One way to think of a session object is as a logical extension of the client program that runs on the server. An entity bean is a component that represents an object-oriented view of some entities stored in persistent storage, such as a database, or entities that are implemented by an existing enterprise application.

Question 69.
What are the methods of Entity Bean?
Answer:
Here we will talk about the implementation of an Entity Bean, not about a home interface. An entity bean consists of 4 groups of methods:
1. create methods.Theylooklikethis: EntityBeanClassejbCreateXXX(parameters), where EntityBeanClass is an Entity Bean you are trying to instantiate, ejbCreateXXX(parameters) methods are used for creating Entity Bean instances according to the parameters specified and to some programmer- defined conditions. Implementation of creating ( ) methods of the home interface is necessary only in Entity Beans with Bean-Managed Persistence.

2. finder methods. Each finder method is used for finding Entity Beans (single objects or a collection of objects) within the home. There is a method used for finding objects by the unique identifier (a Primary Key) – findByPrimaryKey( PrimaryKeyClass). This method returns a single Entity Bean, whereas most other finder methods return a Collection of remote interfaces.

3. remove methods. These methods (you may have up to 2 remove methods, or don’t have them at all) allow the client to physically remove Entity Beans. You can remove these beans by specifying either Handle or a Primary Key for the Entity Bean.

4. home methods. These methods are designed and implemented by a developer, and EJB specification doesn’t have any requirements for them except the need to throw a RemoteException in each home method.

Question 70.
How does Stateful Session bean store its state?
Answer:
First of all, a Stateful Session bean is a Session Bean instance containing some conversational state (a result of data interchange or processing), which needs to be retained across methods and transactions.

A Stateful Session bean stores its state in the instance’s fields and objects referred to from these fields. These fields may contain some up-to-time information as open sockets or database connections.

Question 71.
Why does Stateless Session bean not store its state even though it has ejbActivate() and ejbPassivate()?
Answer:
To answer this question you need to remember what a Stateless Session bean is. It’s a Session Bean instance NOT containing any conversational state. Such beans are used mostly for performing some atomic operations, because NO data, is saved in the instance’s variables. The other point is that you never know which instance serves your application request at a given time. If your application requests; a Stateless Session bean once and another Stateless Session bean in some time, you
can never be sure that a Container gives you the same reference.

In conclusion, the Stateless Session beans have the ejbActivate( ) and ejbPassivate( ) methods, but there is no sense to rely on their persistence, because of the implementation of such beans.

Question 72.
What are the services provided by the container?
Answer:
A container provides a set of services listed below:

1. Enterprise Java Beans support. The support for EJBs is mandatory for each container. It must support all types of beans specified by SUN. (The latest specification is 2.0, though its final version is not yet released, most EJB containers already support it.)

2. JTS (Java Transaction Service). This service is intended to control transactions within an enterprise system.

3. JNDI (Java Naming and Directory Interface). Every EJB Container MUST provide a name space for accessing resources (including EJB instances), as well as a way to access them using JNDI.

4. JDBC (Java DataBase Connection). A Container must be able to provide EJBs with the ability to access existing database(s). In most cases, the XA and connection pooling are also supported, but it’s also a headache for a JDBC driver vendor.

5. JMS (Java Messaging Service). This service is new to EJB, and it was introduced j in EJB 2.0. This service allows interchange of asynchronous messages. EJB 2.0 also introduced the new type of beans – Message-driven Beans invoked by a Container only.

Question 73.
Types of transactions?
Answer:
EJBs may participate (and often do it) in database transactions. Just remember some database fundamentals:

1. Simple transactions. Transactions performing simple operations. This type of transaction is the most often used.

2. Nested transactions. Transactions can be nested, i.e. some method, which opens a transaction, may call another method, also opening a transaction. In such a case, a nested transaction appears. There is no need to make such transactions explicitly because most systems don’t require such complicated! logic. Nevertheless, modern database servers support nested transactions.
Note that if an inner transaction rolls back, the outer transaction automatically rolls back, and if an inner transaction fails, the outer transaction also fails.

3. Distributed transactions. This kind of transaction is used for performing operations on data located in different databases. If more than one database is involved in a transaction, such a transaction is called a distributed transaction.

Question 74.
What is a bean-managed transaction?
Answer:
If a developer doesn’t want a Container to manage transactions, it’s possible to implement all database operations manually by writing the appropriate JDBC code. This often leads to productivity increase, but it makes an Entity Bean incompatible with some databases and it enlarges the amount of code to be written. A developer explicitly performs all transaction management.

Question 75.
Why does E JB need two interfaces (Home and Remote Interface)?
Answer:
A client searches for a home interface to instantiate a remote interface. A remote interface is a client-side mapping to a server object performing business methods. Such schema was introduced purposely to demarcate the difference between server and client interfaces.

Question 76.
What are transaction attributes?
Answer:
The transaction attribute specifies how the Container must manage transactions for a method when a client invokes the method via the enterprise bean’s home or component interface or when the method is invoked as the result of the arrival of a JMS message. (Sun’s EJB Specification) Below is a list of transactional attributes:

1. NotSupported – transaction context is unspecified.

2. Required – bean’s method invocation is made within a transactional context. If a client is not associated with a transaction, a new transaction is invoked automatically.

3. Supports – if a transactional context exists, a Container acts like the transaction attribute is Required, else – like NotSupported.

4. RequiresNew – a method is invoked in a new transaction context.

5. Mandatory-if a transactional context exists, a Container acts like the transaction attribute is required, else it throws a javax.EJB.TransactionRequiredException.

6. Never – a method executes only if no transaction context is specified.

Question 77.
What is the difference between Container-Managed Persistent (CMP) bean and Bean-Managed (BMP) persistent entity bean?
Answer:
A CMP bean developer doesn’t need to worry about JDBC code and ^transactions, because the Container performs database calls and transaction management instead of the programmer. All table mapping is specified in the deployment descriptor. Otherwise, a BMP bean developer takes the load of linking an application and a database on his shoulders.

BMP beans are not 100% database-independent, because they may contain database-specific code, but CMP beans are unable to perform complicated DML (data manipulation language) statements. EJB 2.0 specification introduced some new ways of querying databases (by using the EJB QL – query language).

Question 78.
How entity bean is created using the CMP entity bean?
Answer:
The container creates an entity bean automatically. Here, “automatically” means that a developer doesn’t need to write any SQL code for it. Certainly, this doesn’t exempt a programmer from implementing business methods.

Question 79.
What is the software architecture of EJB?
Answer:
Session and Entity EJBs consist of 4 or 5 parts: a remote interface (a client interacts with it), a home interface (used for creating objects and for declaring business methods) a bean object (an object, which actually performs business logic, and E JB-specific operations). The fourth part is a deployment descriptor (an XML file containing all information required for maintaining the EJB) or a set of deployment descriptors (if you are using some container-specific features). The fifth part – a Primary Key class – is only Entity bean specific.

Question 80.
Can Entity Beans have no created ( ) methods?
Answer:
Certainly. In some cases, the data is inserted NOT using Java application, so you may only need to retrieve the information, perform its processing, but not create your own information of this kind.

Question 81.
In which case, ejbLoad( ) doesn’t read data from the database?
Answer:
ejbLoad( ) reads data from the database in all cases except one: when the information stored in an Entity Bean has not been changed after creation or retrieving. In this case, ejbLoad( ) becomes a redundant operation.

Question 82.
What is an “eager loading of state”?
Answer:
An EJB container usually reads all data to construct the Entity Bean. This is opposite to “lazy loading” when data is read as pieces, not as a whole block. This increases speed in most cases but makes the application more complicated.

Question 83.
How would you implement a case when Entity Bean 1 calls Entity Bean 2, which calls Entity Bean 1?
Answer:
You need to mark Entity Bean 1 as a re-entrant.

Question 84.
How would you implement EJB subclassing?
Answer:
The following guidelines assume that we have EJB2, which subclasses EJB1. (Both EJBs are session ones.) The Remote interface of EJB2 implements the Remote interface of EJB1 The Bean class of EJB2 extends the Bean class of EJB1

Question 85.
What is the difference between Stateful and Stateless Session Bean?
Answer:
A Stateful Session Bean is a bean that is designed to service business processes that span multiple method requests or transactions. Stateful Session beans retain state on behalf of an individual client. Stateless Session Beans do not maintain a state.
EJB containers pool stateless session beans and reuse them to service many clients. Stateful session beans can be passivated and reused for other clients. But this involves I/O bottlenecks. Because a stateful session bean caches client conversation in memory, a bean failure may result in loosing the entire client conversation. Therefore, while writing a stateful session bean the bean developer has to keep the bean failure and client conversation loss in mind.

In the case of stateless session beans, client-specific data has to be pushed to the bean for each method invocation, which will result in an increase in the network traffic. This can be avoided in a number of ways like persisting the client-specific data in a database or in JNDI. But this also results in I/O performance bottlenecks.

If the business process spans multiple invocations thereby requiring a conversation then stateful session bean will be the ideal choice. On the other hand, if business process lasts only for a single method call, the stateless session bean model suits. Stateful session beans remember the previous request and responses. But stateless beans do not. stateful does not have a pooling concept, whereas the stateless bean instances are pooled

Question 86.
Difference between forward(request,response) and SendRedirect(url) in Servlet?
Answer:
With forwarding, request & response would be passed to the destination URL which should be relative (means that the destination URL should be within a servlet context). Also, after executing the forward method, the control will return back to the same method from where the forward method was called. All the opposite to the above points apply to sendRedirect.
(OR)The forward will redirect to the application server itself. It does not come to the client. Whereas Response.send redirect( ) will come to the client and go back …i.e. URL appending will happen.

Question 87.
What is enterprise bean?
Answer:
• Server-side reusable java component
• Offers services that are hard to implement by the programmer
• Sun: Enterprise Bean architecture is a component architecture for the deployment and development of component-based distributed business applications.

Applications written using enterprise java beans are scalable, transactional and multi-user secure. These applications may be written once and then deployed on any server platform that supports enterprise java beans specification.

• Enterprise beans are executed by the J2EE server. First version 1.0 contained session beans, entity beans were not included. Entity beans were added to version 1.1 which came out during year 1999. The current release is EJB version 1.2

Question 88.
Services of EJB?
Answer:
Database management

  • Database connection pooling
  • DataSource, offered by the J2EE server. Needed to access connection pool of the server.
  • Database access is configured to the J2EE server -> easy to change database/database driver
  • Transaction management
  • Distributed transactions
  • J2EE server offers a transaction monitor which can be accessed by the client.
  • Security management
  • Authentication
  • Authorization
  • encryption

Enterprise java beans can be distributed /replicated into separate machines distribution/replication offers

  • Load balancing, the load can be divided into separate servers.
  • Failover, if one server fails, others can keep on processing normally.
  • Performance, one server is not so heavily loaded. Also, for example, Weblogic has thread pools for improving performance in one server.

Question 89.
When to choose EJB?
Answer:
The server will be heavy loaded

  • The distribution of servers helps to achieve better performance.
  • The server should have a replica for the case of failure of one server.
  • Replication is invisible to the programmer
  • Distributed transactions are needed
  • J2EE server offers a transaction monitor that takes care of transaction management.
  • Distributed transactions are invisible to the programmer Other services vs. money
    Weblogic J2EE server ~ 80 000 MK and Jbuilder X Professional Edition ~ 5 OOOmk

Question 90.
Why not use free J2EE servers?
Answer:

  • no technical support
  • harder to use (no graphical user interface …)
  • no integration to development tools (for example, Jbuilder)
  • Bugs? Other problems during the project?

Question 91.
What J2EE server offers?
Answer:
DataSource.

  • An object that can be used to achieve database connection from the connection pool.
  • Can be accessed by the interface DataSource
  • Transaction monitor
  • Can be accessed by the interface UserTransaction.
    Java Naming and the Directory Service

Question 92.
Java Naming and the Directory Service
Answer:
Naming service is needed to locate beans home interfaces or other objects (DataSource, UserTransaction)

  • For example, jndi name of the DataSource A directory service is needed to store and retrieve properties by their name.
  • jndi name: java:comp/env/propertyName

Question 93.
XML – deployment descriptor
Answer:
ejb-jar.xml + server-specific xml- file Which is then Packed in a jar — file together with bean classes.
Beans are packaged into EJB JAR file, Manifest file is used to fist EJB’s and jar file holding Deployment descriptor.

Question 94.
Session Bean
Answer:
Developer programs three classes:

  • The home interface contains methods for creating (and locating for entity beans) bean instances.
  • The remote interface contains business methods the bean offers.
  • Bean class contains the business logic of the enterprise bean.

Question 95.
Entity Beans
Answer:
Represents one row in the database.

  • Easy way to access database
  • Business logic concept to manipulate data.
  • Container managed persistence vs. bean-managed persistence.

The programmer creates three or four classes:

  • Home interface for locating beans
  • The remote interface contains business methods for clients.
  • Bean class that implements bean’s behavior.
  • Primary key class – represents the primary key in the database. Used to locate beans.

Primary key class is not needed if the primary key is a single field that could be j

When to use which bean?

Entity beans are effective when an application wants to access one row at a time. If many rows need to be fetched, using session beans can be a better alternative java class (for example, Integer).
Entity beans are efficient when working with one row at a time

Cause a lot of network traffic.
Session Beans are efficient when the client wants to access the database directly.

  • fetching/updating multiple rows from the database

Question 96.
Explain J2EE Architecture?
Answer:
Normally, thin-client multitiered applications are hard to write because they involve many lines of intricate code to handle transaction and state management, multithreading, resource pooling, and other complex low-level details.

The component-based and platform-independent J2EE architecture makes J2EE applications easy to write because business logic is organized into reusable components and the J2EE server provides underlying services in the form of a container for every component type. Because you do not have to develop these services yourself, you are free to concentrate on solving the business problem at hand.

Containers and Services
Components are installed in their containers during deployment and are the interface between a component and the low-level platform-specific functionality that supports the component. Before a web, enterprise bean, or application client component can be executed, it must be assembled into a J2EE application and deployed into its container.

The assembly process involves specifying container settings for each component in the J2EE application and for the J2EE application itself. Container settings customize the underlying support provided by the J2EE Server, which include services such as security, transaction management, Java Naming and Directory Interface TM (JNDI) lookups, and remote connectivity.
Figure: J2EE Server and Containers
Container Types
The deployment process installs J2EE application components in the following types

Question 99.
What is the difference between BeanMangedPersistance and Container- MangedPersistance?
Answer:
CMP: Tx behavior in beans are defined in transaction attributes of the methods
BMP: Programmers have to write a code that implements Tx behavior to the bean class. Tuned CMP entity beans offer better performance than BMP entity beans. Moving towards the CMP-based approach provides database independence since it does not contain any database storage APIs within it. Since the container performs database operations on behalf of the CMP entity bean, they are harder to debug. BMP beans offer more control and flexibility than CMP beans.

Diff 1) In BMP you will take care of all the connections and you write the SQL code inside the bean whereas in CMP the container will take care of it Diff 2) The BMP is not portable across all DB’s.whereas the CMP is

Question 100.
How Servlet Maintain Session and EJB Maintain Session?
Answer:
Servlets maintain sessions in ServleContext and EJB’s in EJBContext.

Question 101.
What is “attribute”?
Answer:
A qualifier on an XML tag that provides additional information.

Question 102.
What is authentication?
Answer:
The process that verifies the identity of a user, device, or other entity in a computer system, usually a prerequisite to allowing access to resources in a system. The Java servlet specification requires three types of authentication-basic, form-based, and mutual-and supports digest authentication.

Question 103.
What is authorization?
Answer:
The process by which access to a method or resource is determined. Authorization depends on the determination of whether the principal associated with a request through authentication is in a given security role. A security role is a logical grouping of users defined by the person who assembles the application. A deployer maps security roles to security identities. Security identities may be principals or groups in the operational environment.

Question 104.
What is an authorization constraint?
Answer:
An authorization rule that determines who is permitted to access a Web resource collection.

Question 105.
What is B2B?
B2B stands for Business-to-business.

Question 106.
What is a backing bean?
Answer:
A JavaBeans component that corresponds to a JSP page that includes JavaServer Faces components. The backing bean defines properties for the components on the page and methods that perform processing for the component. This processing includes event handling, validation, and processing associated with navigation.

Question 107.
What is basic authentication?
Answer:
An authentication mechanism in which a Web server authenticates an entity via a user name and password obtained using the Web application’s built-in authentication mechanism.

Question 103.
What is bean-managed persistence?
Answer:
The mechanism whereby data transfer between an entity bean’s variables and a resource manager is managed by the entity bean.

Question 109.
What is a bean-managed transaction?
Answer:
A transaction whose boundaries are defined by an enterprise bean.

Question 110.
What is binding (XML)?
Answer:
Generating the code needed to process a well-defined portion of XML data.

Question 111.
What is binding (JavaServer Faces technology)?
Answer:
Wiring UI components to back-end data sources such as backing bean properties.

Question 112.
What is a build file?
Answer:
The XML file contains one or more ascent targets. A target is a set of tasks you want to be executed. When starting ascent, you can select which targets you want to have executed. When no target is given, the project’s default target is executed.

Question 113.
What is business logic?
Answer:
The code that implements the functionality of an application. In the Enterprise JavaBeans architecture, this logic is implemented by the methods of an enterprise bean.

Question 114.
What is the business method?
Answer:
A method of an enterprise bean that implements the business logic or rules of an application.

Question 115.
What are callback methods?
Answer:
Component methods are called by the container to notify the component of important events in its life cycle.

Question 116.
What is the caller?
Answer:
Same as caller principal.

Question 117.
What is caller principal?
Answer:
The principal that identifies the invoker of the enterprise bean method.

Question 118.
What is cascade delete?
Answer:
A deletion that triggers another deletion. A cascade delete can be specified for an entity bean that has container-managed persistence.

Question 119.
What is CDATA?
Answer:
A predefined XML tag for character data means “don’t interpret these characters,” as opposed to parsed character data (PCDATA), in which the normal rules of XML syntax apply. CDATA sections are typically used to show examples of XML syntax.

Question 120.
What is a certificate authority?
Answer:
A trusted organization that issues public key certificates and provides identification to the bearer.

Question 121.
What is client-certificate authentication?
Answer:
An authentication mechanism that uses HTTP over SSL, in which the server and, optionally, the client authenticate each other with a public key certificate that conforms to a standard that is defined by X.509 Public Key Infrastructure.

Question 122.
What is a comment?
Answer:
In an XML document, the text is ignored unless the parser is specifically told to recognize it.

Question 123.
What is commit?
Answer:
The point in a transaction is when all updates to any resources involved in the transaction are made permanent.

Question 124.
What is the component contract?
Answer:
The contract between a J2EE component and its container. The contract includes life-cycle management of the component, a context interface that the instance uses to obtain various information and services from its container, and a list of services that every container must provide for its components.

Question 125.
What is component-managed sign-on?
Answer:
A mechanism whereby security information needed for signing on to a resource is provided by an application component.

Question 126.
What is a connector?
Answer:
A standard extension mechanism for containers that provides connectivity to enterprise information systems. A connector is specific to an enterprise information system and consists of a resource adapter and application development tools for enterprise information system connectivity. The resource adapter is plugged into a container through its support for system-level contracts defined in the Connector architecture.

Question 127.
What is container-managed persistence?
Answer:
The mechanism whereby data transfer between an entity bean’s variables and a resource manager is managed by the entity bean’s container.

Question 128.
What is container-managed sign-on?
Answer:
The mechanism whereby security information needed for signing on to a resource is supplied by the container.

Question 129.
What is a container-managed transaction?
Answer:
A transaction whose boundaries are defined by an E JB container. An entity bean must use container-managed transactions.

Question 130.
What is content?
Answer:
In an XML document, the part that occurs after the prolog, including the root element and everything it contains.

Question 131.
What is a context attribute?
Answer:
An object bound into the context associated with a servlet.

Question 132.
What is context root?
Answer:
A name that gets mapped to the document root of a Web application.

Question 133.
What is the conversational state?
Answer:
The field values of a session bean plus the transitive closure of the objects reachable from the bean’s fields. The transitive closure of a bean is defined in terms of the serialization protocol for the Java programming language, that is, the fields that would be stored by serializing the bean instance.

Question 134.
What is CORBA?
Answer:
Common Object Request Broker Architecture. A language-independent distributed object model specified by the OMG.

Question 135.
What is create method?
Answer:
A method defined in the Interview Questions – Home interface and invoked by a client to create an enterprise bean.

Question 136.
What are credentials?
Answer:
The information describing the security attributes of a principal.

Question 137.
What is CSS?
Answer:
Cascading style sheet. A style sheet is used with HTML and XML documents to add a style to all elements marked with a particular tag, for the direction of browsers or other presentation mechanisms.

Question 138.
What is CTS?
Answer:
Compatibility test suite. A suite of compatibility tests for verifying that a J2EE product complies with the J2EE platform specification.

Question 139.
What is data?
Answer:
The contents of an element in an XML stream, generally used when the element does not contain any subelements. When it does, the term content is generally used. When the only text in an XML structure is contained in simple elements and when elements that have subelements have little or no data mixed in, then that structure is often thought of as XML data, as opposed to an XML document.

Question 140.
What is DDP?
Answer:
Document-driven programming. The use of XML to define applications.

Question 141.
What is a declaration?
Answer:
The very first thing in an XML document, which declares it as XML. The minimal declaration is. The declaration is part of the document prolog.

Question 142.
What is declarative security?
Answer:
Mechanisms used in an application are expressed in a declarative syntax in a deployment descriptor.

Question 143.
What is delegation?
Answer:
An act whereby one principal authorizes another principal to use its identity or privileges with some restrictions.

Question 144.
What is a deployer?
Answer:
A person who installs J2EE modules and applications into an operational environment.

Question 145.
What is deployment?
Answer:
The process whereby software is installed into an operational environment.

Question 146.
What is a deployment descriptor?
Answer:
An XML file is provided with each module and J2EE application that describes how they should be deployed. The deployment descriptor directs a deployment tool to deploy a module or application with specific container options and describes specific configuration requirements that a deployer must resolve.

Question 147.
What is destination?
Answer:
A JMS administered object that encapsulates the identity of a JMS queue or topic. See point-to-point messaging system, publish/subscribe messaging system.

Question 148.
What is digest authentication?
Answer:
An authentication mechanism in which a Web application authenticates itself to a Web server by sending the server a message digest along with its HTTP request message. The digest is computed by employing a one-way hash algorithm to a concatenation of the HTTP request message and the client’s password. The digest is typically much smaller than the HTTP request and doesn’t contain the password.

Question 149.
What has distributed application?
Answer:
An application is made up of distinct components running in separate runtime environments, usually on different platforms connected via a network. Typical distributed applications are two-tier (client-server), three-tier (client-middleware- server), and multitier (client-multiple middleware-multiple servers).

Question 150.
What is a document?
Answer:
In general, an XML structure in which one or more elements contains text intermixed with subelements.

Question 151.
What is Document Object Model?
Answer:
An API for accessing and manipulating XML documents as tree structures. DOM provides platform-neutral, language-neutral interfaces that enable programs and scripts to dynamically access and modify content and structure in XML documents.

Question 152.
What is document root?
Answer:
The top-level directory of a WAR. The document root is where JSP pages, client-side classes and archives, and static Web resources are stored.

Question 153.
What is DTD?
Answer:
Document type definition. An optional part of the XML document prolog, as specified by the XML standard. The DTD specifies constraints on the valid tags and tag sequences that can be in the document. The DTD has a number of shortcomings, however, and this has led to various schema proposals. For example, the DTD entry says that the XML element called username contains parsed character data-that is, text alone, with no other structural elements under it.

The DTD includes both the local subset, defined in the current file, and the external subset, which consists of the definitions contained in external DTD files that are referenced in the local subset using a parameter entity.

Question 154.
What is a durable subscription?
Answer:
In a JMS publish/subscribe messaging system, a subscription continues to exist whether or not there is a current active subscriber object. If there is no active subscriber, the JMS provider retains the subscription’s messages until they are received by the subscription or until they expire.

Question 155.
What is an EAR file?
Answer:
Enterprise Archive file. A JAR archive that contains a J2EE application.

Question 156.
What is ebXML?
Answer:
Electronic Business XML. A group of specifications designed to enable enterprises to conduct business through the exchange of XML-based messages. It is sponsored by OASIS and the United Nations Centre for the Facilitation of Procedures and Practices in Administration, Commerce, and Transport (U.N./CEFACT).

Question 157.
What is Java API for XML Processing (JAXP)?
Answer:
An API for processing XML documents. JAXP leverages the parser standards SAX and DOM so that you can choose to parse your data as a stream of events or to build a tree-structured representation of it. JAXP supports the XSLT standard, giving you control over the presentation of the data and enabling you to convert the data to other XML documents or to other formats, such as HTML. JAXP provides namespace support, allowing you to work with a schema that might otherwise have naming conflicts.

Question 158.
What is Java API for XML Registries (JAXR)?
Answer:
An API for accessing various kinds of XML registries.

Question 159.
What is Java API for XML-based RPC (JAX-RPC)?
Answer:
An API for building Web services and clients that use remote procedure calls and XML.

Question 160.
What is Java IDL?
Answer:
A technology that provides CORBA interoperability and connectivity capabilities for the J2EE platform. These capabilities enable J2EE applications to invoke operations on remote network services using the Object Management Group IDL and HOP.

Question 161.
What is Java Secure Socket Extension (JSSE)?
Answer:
A set of packages that enable secure Internet communications.

Question 162.
What is Java Transaction API (JTA)?
Answer:
An API that allows applications and J2EE servers to access transactions.

Question 163.
What is Java Transaction Service (JTS)?
Answer:
Specifies the implementation of a transaction manager that supports JTA and implements the Java mapping of the Object Management Group Object Transaction Service 1.1 specification at the level below the API.

Question 164.
What is the JavaBeans component?
Answer:
A Java class that can be manipulated by tools and composed into applications. A JavaBeans component must adhere to certain property and event interface conventions.

Question 165.
What is JavaMaii?
Answer:
An API for sending and receiving emails.

Question 166.
What is a local subset?
Answer:
That part of the DTD is defined within the current XML file.

Question 167.
What is a tag?
Answer:
In XML documents, a piece of text describes a unit of data or an element. The tag is distinguishable as markup, as opposed to data, because it is surrounded by angle brackets (< and >). To treat such markup syntax as data, you use an entity reference or a CDATA section.

Question 168.
What is a template?
Answer:
A set of formatting instructions that apply to the nodes selected by an XPath expression.

Question 169.
What is a tool provider?
Answer:
An organization or software vendor that provides tools used for the development, packaging, and deployment of J2EE applications.

Question 170.
What is a transaction attribute?
Answer:
A value specified in an enterprise bean’s deployment descriptor is used by the EJB container to control the transaction scope when the enterprise bean’s methods are invoked. A transaction attribute can have the following values: Required, RequiresNew, Supports, NotSupported, Mandatory, or Never.

Question 171.
What is a transaction?
Answer:
An atomic unit of work that modifies data. A transaction encloses one or more program statements, all of which are either complete or rollback. Transactions enable multiple users to access the same data concurrently.

Question 172.
What is the transaction isolation level?
Answer:
What is transaction isolation level The degree to which the intermediate state of the data being modified by a transaction is visible to other concurrent transactions and data being modified by other transactions is visible to it.

Question 173.
What is a transaction manager?
Answer:
Provides the services and management functions required to support transaction demarcation, transactional resource management, synchronization, and transaction context propagation.

Question 174.
What is Unicode?
Answer:
A standard defined by the Unicode Consortium uses a 16-bit code page that maps digits to characters in languages around the world. Because 16 bits cover 32,768 codes, Unicode is large enough to include all the world’s languages, with the exception of ideographic languages that have a different character for every concept, such as Chinese.

Question 175.
What is Universal Description, Discovery, and Integration (UDDI) project?
Answer:
An industry initiative to create a platform-independent, open framework for describing services, discovering businesses, and integrating business services using the Internet, as well as a registry. It is being developed by a vendor consortium.

Question 176.
What is Universal Standard Products and Services Classification (UNSPSC)?
Answer:
A schema that classifies and identifies commodities. It is used in sell-side and buy-side catalogs and as a standardized account code in analyzing expenditure.

Question 177.
What is an unparsed entity?
Answer:
A general entity that contains something other than XML. By its nature, an unparsed entity contains binary data.

Question 178.
What is a user data constraint?
Answer:
Indicates how data between a client and a Web container should be protected. The protection can be the prevention of tampering with the data or the prevention of eavesdropping on the data.

Question 179.
What is a user (security)?
Answer:
An individual (or application program) identity that has been authenticated. A user can have a set of roles associated with that identity, which entitles the user to access all resources protected by those roles.

Question 180.
What is validating parser?
Answer:
A parser that ensures that an XML document is valid in addition to being well formed. See also parser.

Question 181.
What is the value-binding expression?
Answer:
A JavaServer Faces EL expression that refers to a property of a backing bean. A component tag uses this expression to bind the associated component’s value or the component instance to the bean property. If the component tag refers to the property via its value attribute, then the component’s value is bound to the property. If the component tag refers to the property via its binding attribute then the component itself is bound to the property.

Question 182.
What is a virtual host?
Answer:
Multiple hosts plus domain names mapped to a single IP address.

Question 183.
What is W3C?
Answer:
World Wide Web Consortium. The international body that governs Internet standards. Its Web site is http://www.w3.org/.

Question 184.
What is a WAR file?
Answer:
Web application archive file. A JAR archive that contains a Web module.

Question 185.
What is the warning?
Answer:
A SAX parser warning is generated when the document’s DTD contains duplicate definitions and in similar situations that are not necessarily an error but which the document author might like to know about because they could be. See also fatal error, error.

Question 186.
What is Web service?
Answer:
An application that exists in a distributed environment, such as the Internet. A Web service accepts a request, performs its function based on the request, and returns a response. The request and the response can be part of the same operation, or they can occur separately, in which case the consumer does not need to wait for a response. Both the request and the response usually take the form of XML, a portable data-interchange format, and are delivered over a wire protocol, such as HTTP.

Question 187.
What is well-formed?
1 Answer:
An XML document that is syntactically correct. It does not have any angle brackets that are not part of tags, all tags have an ending tag or are themselves I am self-ending, and all tags are fully nested. Knowing that a document is well-formed makes it possible to process it. However, a well-formed document may not be valid. To determine that, you need a validating parser and a DTD.

Question 188.
What is Xalan?
Answer:
An interpreting version of XSLT.

Question 189.
What is XHTML?
Answer:
An XML look-alike for HTML defined by one of several XHTML DTDs. To use XHTML for everything would of course defeat the purpose of XML, because the idea of XML is to identify information content, and not just to tell how to display it. You can reference it in a DTD, which allows you to say, for example, that the text in an element can contain < em > and < b > tags rather than being limited to plain text.

Question 190.
What is XLink?
Answer:
The part of the XLL specification is concerned with specifying links between documents.

Question 191.
What is XLL?
Answer:
The XML Link Language specification, consisting of XLink and XPointer.

Question 192.
What is XML?
Answer:
Extensible Markup Language. A markup language that allows you to define the tags (markup) needed to identify the content, data, and text in XML documents. It differs from HTML, the markup language most often used to present information on the Internet. HTML has fixed tags that deal mainly with style or presentation. An XML document must undergo a transformation into a language with style tags under the control of a style sheet before it can be presented by a browser or other presentation mechanism. Two types of style sheets used with XML are CSS and XSL. Typically, XML is transformed into HTML for presentation.

Although tags can be defined as needed in the generation of an XML document, a document type definition (DTD) can be used to define the elements allowed in a particular type of document. A document can be compared by using the rules in the DTD to determine its validity and to locate particular elements in the document. A Web services application’s J2EE deployment descriptors are expressed in XML with schemas defining allowed elements. Programs for processing XML documents use SAX or DOM APIs.
I 336 I C, C++, JAVA & J2EE Interview Questions

Question 193.
What is an XML registry?
Answer:
An infrastructure that enables the building, deployment, and discovery of Web services. It is a neutral third party that facilitates dynamic and loosely coupled business-to-business (B2B) interactions.

Question 194.
What is XML Schema?
Answer:
The W3C specification for defining the structure, content, and semantics of XML documents.

Question 195.
What is XPath?
Answer:
An addressing mechanism for identifying the parts of an XML document.

Question 196.
What is XPointer?
Answer:
The part of the XLL specification is concerned with identifying sections of documents so that they can be referenced in links or included in other documents.

Question 197.
What is XSL-FO?
Answer:
A subcomponent of XSL is used for describing font sizes, page layouts, and how information flows from one page to another.

Question 198.
What is Keystore?
Answer:
A file containing the keys and certificates used for authentication.

Question 199.
What is a local subset?
Answer:
That part of the DTD is defined within the current XML file.

Question 200.
What is managed bean creation facility?
Answer:
A mechanism for defining the characteristics of JavaBeans components used in a JavaServer Faces application.

Question 201.
What is a message?
Answer:
In the Java Message Service, an asynchronous request, report, or event is created, sent, and consumed by an enterprise application and not by a human. It contains vital information needed to coordinate enterprise applications, in the form of precisely formatted data that describes specific business actions.

Question 202.
What is a message consumer?
Answer:
An object created by a JMS session that is used for receiving messages sent to a destination.

Question 203.
What is a message-driven bean?
Answer:
An enterprise bean that is an asynchronous message consumer. A message-driven bean has no state for a specific client, but its instance variables can contain states across the handling of client messages, including an open database connection and an object reference to an EJB object. A client accesses a message-driven bean by sending messages to the destination for which the bean is a message listener.

Question 204.
What is a message producer?
Answer:
An object created by a JMS session that is used for sending messages to a destination.

Question 205.
What is the mixed-content model?
Answer:
A DTD specification defines an element as containing a mixture of text and one more another element. The specification must start with #PCDATA, followed by diverse elements, and must end with the “zero-or-more” asterisk symbol (*).

Question 206.
What is the method-binding expression?
Answer:
A JavaServer Faces EL expression that refers to a method of a backing bean. This method performs either event handling, validation, or navigation processing for the UI component whose tag uses the method-binding expression.

Question 207.
What is method permission?
Answer:
An authorization rule that determines who is permitted to execute one or more enterprise bean methods.

Question 208.
What is mutual authentication?
Answer:
An authentication mechanism is employed by two parties for the purpose of proving each other’s identity to one another.

Question 209.
What is namespace?
Answer:
A standard that lets you specify a unique label for the set of element names defined by a DTD. A document using that DTD can be included in any other document without having a conflict between element names. The elements defined in your DTD are then uniquely identified so that, for example, the parser can tell when an element <name> should be interpreted according to your DTD rather than using the definition for an element <name> in a different DTD.

Question 210.
What is naming context?
Answer:
A set of associations between unique, atomic, people-friendly identifiers and objects.

Question 211.
What is a naming environment?
Answer:
A mechanism that allows a component to be customized without the need to access or change the component’s source code. A container implements the component’s naming environment and provides it to the component as a JNDI naming context. Each component names and accesses its environment entries using the java: comp/env JNDI context. The environment entries are declaratively specified in the component’s deployment descriptor.

Question 212.
What is normalization?
Answer:
The process of removing redundancy by modularizing, as with subroutines, and of removing superfluous differences by reducing them to a common denominator. For example, line endings from different systems are normalized by reducing them to a single newline, and multiple whitespace characters are normalized to one space.

Question 213.
What is North American Industry Classification System (NAICS)?
Answer:
A system for classifying business establishments based on the processes they use to produce goods or services.

Question 214.
What is notation?
Answer:
A mechanism for defining a data format for a non-XML document referenced as an unparsed entity. This is a holdover from SGML. A newer standard is to use MIME data types and namespaces to prevent naming conflicts.

Question 215.
What is OASIS?
Answer:
Organization for the Advancement of Structured Information Standards. A consortium that drives the development, convergence, and adoption of e-business standards.

Question 216.
What is OMG?
Answer:
Object Management Group. A consortium that produces and maintains computer industry specifications for interoperable enterprise applications. Its Web site ishttp://www.omg.org/.

Question 217.
What is one-way messaging?
Answer:
A method of transmitting messages without having to block until a response is received.

Question 218.
What is ORB?
Answer:
Object request broker. A library that enables CORBA objects to locate and communicate with one another.

Question 219.
What is OS principal?
Answer:
A principal native to the operating system on which the J2EE platform is executing.

Question 220.
What is OTS?
Answer:
Object Transaction Service. A definition of the interfaces that permit CORBA objects to participate in transactions.

Question 221.
What is a parameter entity?
Answer:
An entity that consists of DTD specifications, as distinct from a general entity. A parameter entity defined in the DTD can then be referenced at other points, thereby eliminating the need to recode the definition at each location it is used.

Question 222.
What is parsed entity?
Answer:
A general entity that contains XML and therefore is parsed when inserted into the XML document, as opposed to an unparsed entity.

Question 223.
What is parser?
Answer:
A module that reads in XML data from an input source and breaks it into chunks so that your program knows when it is working with a tag, an attribute, or element data. A nonvalidating parser ensures that the XML data is well-formed but does not verify that it is valid. See also validating parser.

Question 224.
What is passivation?
Answer:
The process of transferring an enterprise bean from memory to secondary storage.

Question 225.
What is persistence?
Answer:
The protocol for transferring the state of an entity bean between its instance variables and an underlying database.

Question 226.
What is the persistent field?
Answer:
A virtual field of an entity bean that has container-managed persistence; it is stored in a database.

Question 227.
What is POA?
Answer:
Portable Object Adapter. A CORBA standard for building server-side applications that are portable across heterogeneous ORBs.

Question 228.
What is the point-to-point messaging system?
Answer:
A messaging system built on the concept of message queues. Each message is addressed to a specific queue; clients extract messages from the queues established to hold their messages.

Question 229.
What is primary key?
Answer:
An object that uniquely identifies an entity bean within a home.

Question 230.
What is principal?
Answer:
The identity is assigned to a user as a result of authentication.

Question 231.
What is privilege?
Answer:
A security attribute that does not have the property of uniqueness and that can be shared by many principals.

Question 232.
What is processing instruction?
Answer:
Information contained in an XML structure that is intended to be interpreted by a specific application.

Question 233.
What is programmatic security?
Answer:
Security decisions that are made by security-aware applications. Programmatic security is useful when declarative security alone is not sufficient to express the security model of an application.

Question 234.
What is a prolog?
Answer:
The part of an XML document that precedes the XML data. The prolog includes the declaration and an optional DTD.

Question 235.
What is a public-key certificate?
Answer:
Used in client-certificate authentication to enable the server, and optionally the client, to authenticate each other. The public key certificate is the digital equivalent of a passport. It is issued by a trusted organization, called a certificate authority, and provides identification for the bearer.

Question 236.
What is published/subscribe messaging system?
Answer:
A messaging system in which clients address messages to a specific node in a content hierarchy called a topic. Publishers and subscribers are generally anonymous and can dynamically publish or subscribe to the content hierarchy. The system takes care of distributing the messages arriving from a node’s multiple publishers to its multiple subscribers.

Question 237.
What is a query string?
Answer:
A component of an HTTP request URL that contains a set of parameters and values that affect the handling of the request.

Question 238.
What is a queue?
Answer:
See the point-to-point messaging system.

Question 239.
What is RAR?
Answer:
Resource Adapter Archive. A JAR archive that contains a resource adapter module.

Question 240.
What is RDF?
Answer:
Resource Description Framework. A standard for defining the kind of data that an XML file contains. Such information can help ensure semantic integrity-for example-by helping to make sure that a date is treated as a date rather than simply as text.

Question 241.
what is RDF schema?
Answer:
A standard for specifying consistency rules that apply to the specifications contained in an RDF.

Question 242.
what is realm?
Answer:
See security policy domain. Also, a string passed as part of an HTTP request during basic authentication defines a protection space. The protected resources on a server can be partitioned into a set of protection spaces, each with its own authentication scheme or authorization database, or both.

In the J2EE server authentication service, a realm is a complete database of roles, users, and groups that identify valid users of a Web application or a set of Web applications.

Question 243.
WTiat is a reentrant entity bean?
Answer:
An entity bean that can handle multiple simultaneous, interleaved, or nest invocations that will not interfere with each other.

Question 244.
what is a reference?
Answer:
See entity reference.

Question 245.
What is registry?
Answer:
An infrastructure that enables the building, deployment, and discovery of Web services. It is a neutral third party that facilitates dynamic and loosely coupled business-to-business (B2B) interactions.

Question 246.
what is a registry provider?
Answer:
An implementation of a business registry that conforms to a specification for XML registries (for example, ebXML or UDDI).

Question 247.
What is the relationship field?
Answer:
A virtual field of an entity bean having container-managed persistence; it identifies a related entity bean.

Question 248.
What is the remote interface?
Answer:
One of two interfaces for an enterprise bean. The remote interface defines the business methods callable by a client.

Question 249.
What is the remove method?
Answer:
Method defined in the home interface and invoked by a client to destroy an enterprise bean.

Question 250.
What is a render kit?
Answer:
A set of Tenderers that render output to a particular client. The JavaServer Faces implementation provides a standard HTML render kit, which is composed of Tenderers that can render HMTL markup.

Question 251.
What is renderer?
Answer:
A Java class that can render the output for a set of JavaServer Faces UI components.

Question 252.
What is request-response messaging?
Answer:
A method of messaging that includes blocking until a response is received. What is a resource adapter A system-level software driver that is used by an EJB container or an application client to connect to an enterprise information system. A resource adapter typically is specific to an enterprise information system. It is available as a library and is used within the address space of the server or client using it. A resource adapter plugs into a container.

The application components deployed on the container then use the client API (exposed by the adapter) or tool¬generated high-level abstractions to access the underlying enterprise information system. The resource adapter and EJB container collaborate to provide the underlying mechanisms-transactions, security, and connection pooling-for connectivity to the enterprise information system.

Question 253.
What is the resource adapter module?
Answer:
A deployable unit that contains all Java interfaces, classes, and native libraries, implementing a resource adapter along with the resource adapter deployment descriptor.

Question 254.
What is resource manager?
Answer:
Provides access to a set of shared resources. A resource manager participates in transactions that are externally controlled and coordinated by a transaction manager. A resource manager typically is in a different address space or on a different machine from the clients that access it. Note: An enterprise information system is referred to as a resource manager when it is mentioned in the context of resource and transaction management.

Question 255.
What is a resource manager connection?
Answer:
An object that represents a session with a resource manager.

Question 256.
What is a resource manager connection factory?
Answer:
An object used for creating a resource manager connection.

Question 257.
What is RMI?
Answer:
Remote Method Invocation. A technology that allows an object running in one Java virtual machine to invoke methods on an object running in a different Java virtual machine.

Question 258.
What is RMI-IIOP?
Answer:
A version of RMI implemented to use the CORBA HOP protocol. RMI over HOP provides interoperability with CORBA objects implemented in any language if all the remote interfaces are originally defined as RMI interfaces.

Question 259.
What is role (development)?
Answer:
The function is performed by a party in the development and deployment phases of an application developed using J2EE technology. The roles are application component provider, application assembler, deployer, J2EE product provider, EJB container provider, EJB server provider, Web container provider, Web server provider, tool provider, and system administrator.

Question 260.
What is role mapping?
Answer:
The process of associating the groups or principals (or both), recognized by the container with security roles specified in the deployment descriptor. Security roles must be mapped by the deployer before a component is installed in the server.

Question 261.
What is the role (security)?
Answer:
An abstract logical grouping of users is defined by the application assembler. When an application is deployed, the roles are mapped to security identities, such as principals or groups, in the operational environment.
In the J2EE server authentication service, a role is an abstract name for permission to access a particular set of resources. A role can be compared to a key that can open a lock. Many people might have a copy of the key; the lock doesn’t care who you are, only that you have the right key.

Question 262.
What is rollback?
Answer:
The point in a transaction is when all updates to any resources involved in the transaction are reversed.
What is root?
Answer:
The outermost element in an XML document. The element that contains all other elements.

Question 263.
What is SAX?
Answer:
Abbreviation of Simple API for XML.

Question 264.
What is a Simple API for XML?
Answer:
An event-driven interface in which the parser invokes one of several methods supplied by the caller when a parsing event occurs. Events include recognizing an XML tag, finding an error, encountering a reference to an external entity, or processing a DTD specification.

Question 265.
What is schema?
Answer:
A database-inspired method for specifying constraints on XML documents using an XML-based language. Schemas address deficiencies in DTDs, such as the inability to put constraints on the kinds of data that can occur in a particular field. Because schemas are founded on XML, they are hierarchical. Thus it is easier to create an unambiguous specification, and it is possible to determine the scope over which comment is meant to apply.

Question 266.
What is a Secure Socket Layer (SSL)?
Answer:
A technology that allows Web browsers and Web servers to communicate over a secured connection.

What are security attributes?
Answer:
A set of properties associated with a principal. Security attributes can be associated with a principal by an authentication protocol or by a J2EE product provider or both.

Question 267.
What is a security constraint?
Answer:
A declarative way to annotate the intended protection of Web content. A security constraint consists of a Web resource collection, an authorization constraint, and a user data constraint.

Question 268.
What is security context?
Answer:
An object that encapsulates the shared state information regarding security between two entities.

Question 269.
What is security permission?
Answer:
A mechanism defined by J2SE and used by the J2EE platform to express the programming restrictions imposed on application component developers.

Question 270.
What is a security permission set?
Answer:
The minimum set of security permissions that a J2EE product provider must provide for the execution of each component type.

Question 271.
What is the security policy domain?
Answer:
A scope over which security policies are defined and enforced by a security administrator. A security policy domain has a collection of users (or principals), uses a well-defined authentication protocol or protocols for authenticating users (or principals), and may have groups to simplify the setting of security policies.

Question 272.
What is the security role?
Answer:
See role (security).

Question 273.
What is the security technology domain?
Answer:
A scope over which the same security mechanism is used to enforce a security policy. Multiple security policy domains can exist within a single technology domain.

Question 274.
What is a security view?
Answer:
The set of security roles is defined by the application assembler.

Question 275.
What is server certificate?
Answer:
Used with the HTTPS protocol to authenticate Web applications. The certificate can be self-signed or approved by a certificate authority (CA). The HTTPS service of the Sun Java System Application Server Platform Edition 8 will not run unless a server certificate has been installed.

Question 276.
What is server principal?
Answer:
The OS principal that the server is executing as.

Question 277.
What is service element?
Answer:
A representation of the combination of one or more Connector components that share a single-engine component for processing incoming requests.

Question 278.
What is the service endpoint interface?
Answer:
A Java interface that declares the methods that a client can invoke on a Web service.

Question 279.
What is a servlet?
Answer:
A Java program that extends the functionality of a Web server, generating dynamic content and interacting with Web applications using a request-response paradigm.

Question 280.
What is a servlet container?
Answer:
A container that provides the network services over which requests and responses are sent, decodes requests, and formats responses. All servlet containers must support HTTP as a protocol for requests and responses but can also support additional request-response protocols, such as HTTPS.

Question 281.
What is servlet container, distributed?
Answer:
A servlet container that can run a Web application that is tagged as distributable and that executes across multiple Java virtual machines running on the same host or on different hosts.

Question 282.
What is servlet context?
Answer:
An object that contains a servlet’s view of the Web application within which the servlet is running. Using the context, a servlet can log events, obtain URL references to resources, and set and store attributes that other servlets in the context can use

Question 283.
What is servlet mapping?
Answer:
Defines an association between a URL pattern and a servlet. The mapping is used to map requests to servlets.

Question 284.
What is a session?
Answer:
An object used by a servlet to track a user’s interaction with a Web application across multiple HTTP requests. What is session bean?
An enterprise bean that is created by a client and that usually exists only for the duration of a single client-server session. A session bean performs operations, such as calculations or database access, for the client. Although a session bean can be transactional, it is not recoverable should a system crash occur.

Session bean objects either can be stateless or can maintain a conversational state across methods and transactions. If a session bean maintains a state, then the EJB container manages this state if the object must be removed from memory. However, the session bean object itself must manage its own persistent data.

Question 285.
What is SGML?
Answer:
Standard Generalized Markup Language. The parent of both HTML and XML. Although HTML shares SGML’s propensity for embedding presentation information in the markup, XML is a standard that allows information content to be totally separated from the mechanisms for rendering that content.

Question 286.
What is SOAP?
Answer:
Simple Object Access Protocol. A lightweight protocol intended for exchanging structured information in a decentralized, distributed environment. It
defines, using XML technologies, an extensible messaging framework containing a message construct that can be exchanged over a variety of underlying protocols.

Question 287.
What is SOAP with Attachments API for Java (SAAJ)?
Answer:
The basic package for SOAP messaging, SAAJ contains the API for creating and populating a SOAP message.

Question 288.
What is SQL?
Answer:
Structured Query Language. The standardized relational database language for defining database objects and manipulating data.

Question 289.
What is SQL/J?
Answer:
A set of standards that includes specifications for embedding SQL statements in methods in the Java programming language and specifications for calling Java static methods as SQL stored procedures and user-defined functions. An SQL checker can detect errors in static SQL statements at program development time, rather than at execution time as with a JDBC driver.

Question 290.
What is SSL?
Answer:
Secure Socket Layer. A security protocol that provides privacy over the Internet. The protocol allows client-server applications to communicate in a way that cannot be eavesdropped upon or tampered with. Servers are always authenticated, and clients are optionally authenticated.

Question 291.
What is a template?
Answer:
A set of formatting instructions that apply to the nodes selected by an XPath expression.

Question 292.
What is a tool provider?
Answer:
An organization or software vendor that provides tools used for the development, packaging, and deployment of J2EE applications.

Question 293.
What is the topic?
Answer:
See publish-subscribe messaging system.

Question 294.
What is a transaction?
Answer:
An atomic unit of work that modifies data. A transaction encloses one or more program statements, all of which are either complete or rollback. Transactions enable multiple users to access the same data concurrently.

Question 295.
What is a transaction attribute?
Answer:
A value specified in an enterprise bean’s deployment descriptor is used by the EJB container to control the transaction scope when the enterprise bean’s methods are invoked. A transaction attribute can have the following values: Required, RequiresNew, Supports, NotSupported, Mandatory, or Never.

Question 296.
What is the transaction isolation level?
Answer:
The degree to which the intermediate state of the data being modified by a transaction is visible to other concurrent transactions and data being modified by other transactions is visible to it.

Question 297.
What is transaction manager?
Answer:
Provides the services and management functions required to support transaction demarcation, transactional resource management, synchronization, and transaction context propagation.

Question 298.
what is Unicode?
Answer:
A standard defined by the Unicode Consortium uses a 16-bit code page that maps digits to characters in languages around the world. Because 16 bits covers 32,768 codes, Unicode is large enough to include all the world’s languages, with the exception of ideographic languages that have a different character for every concept, such as Chinese.

Question 299.
What is Universal Description, Discovery, and Integration (UDDI) project?
Answer:
An industry initiative to create a platform-independent, open framework for describing services, discovering businesses, and integrating business services using the Internet, as well as a registry. It is being developed by a vendor consortium.

Question 300.
What is Universal Standard Products and Services Classification (UNSPSC)?
Answer:
A schema that classifies and identifies commodities. It is used in sell-side and buy-side catalogs and as a standardized account code in analyzing expenditure.

Question 301.
what is an unparsed entity?
Answer:
A general entity that contains something other than XML. By its nature, an unparsed entity contains binary data.

Question 302.
What is user data constraint?
Answer:
Indicates how data between a client and a Web container should be protected. The protection can be the prevention of tampering with the data or the prevention of eavesdropping on the data.

Question 303.
What is a user (security)?
Answer:
An individual (or application program) identity that has been authenticated. A user can have a set of roles associated with that identity, which entitles the user to access all resources protected by those roles.

Question 304.
What is valid?
Answer:
A valid XML document, in addition to being well formed, conforms to all the constraints imposed by a DTD. It does not contain any tags that are not permitted by the DTD, and the order of the tags conforms to the DTD’s specifications.

Question 305.
What is validating parser?
Answer:
A parser that ensures that an XML document is valid in addition to being well formed. See also parser.

Question 306.
What is value-binding expression?
Answer:
A JavaServer Faces EL expression that refers to a property of a backing bean. A component tag uses this expression to bind the associated component’s value or the component instance to the bean property. If the component tag refers to the property via its value attribute, then the component’s value is bound to the property. If the component tag refers to the property via its binding attribute then the component itself is bound to the property.

Question 307.
What is a virtual host?
Answer:
Multiple hosts plus domain names mapped to a single IP address.

Question 308.
What is Xalan?
Answer:
An interpreting version of XSLT.

Question 309.
What is XHTML?
Answer:
An XML look-alike for HTML defined by one of several XHTML DTDs. To use XHTML for everything would of course defeat the purpose of XML because the idea of XML is to identify information content, and not just to tell how to display it. You can reference it in a DTD, which allows you to say, for example, that the text in an element can contain <em> and <b> tags rather than being limited to plain text.

Question 310.
WhatisXLink?
Answer:
The part of the XLL specification is concerned with specifying links between documents.

Question 311.
What is XLL?
Answer:
The XML Link Language specification, consisting of XLink and XPointer.

Question 312.
What is XML?
Answer:
Extensible Markup Language. A markup language that allows you to define the tags (markup) needed to identify the content, data, and text in XML documents. It differs from HTML, the markup language most often used to present information on the Internet. HTML has fixed tags that deal mainly with style or presentation.

An XML document must undergo a transformation into a language with style tags under the control of a style sheet before it can be presented by a browser or other presentation mechanism. Two types of style sheets used with XML are CSS and XSL. Typically, XML is transformed into HTML for presentation. Although tags can be defined as needed in the generation of an XML document, a document type definition (DTD) can be used to define the elements allowed in a particular type of document. A document can be compared by using the rules in the DTD to determine its validity and to locate particular elements in the document. A Web services application’s J2EE deployment descriptors are expressed in XML with schemas defining allowed elements. Programs for processing XML documents use SAX or DOM APIs.

Question 313.
What is XML registry?
Answer:
See registry.

Question 314.
What is XML Schema?
Answer:
The W3C specification for defining the structure, content, and semantics of XML documents.

Question 315.
Explain DOM and SAX Parser?
Answer:
DOM parser is one which makes the entire XML passed as a tree Structure and will have it in memory. Any modification can be done to the XML.
SAX parser is one that triggers predefined events when the parser encounters the tags in XML, an Event-driven parser. Entire XML will not be stored in memory. Bit faster than DOM. NO modifications can be done to the XML.

Question 316.
What types of Servlets do you know?
Answer:
There are two types of Servlets – GenericServlet and HttpServlet.

Question 317.
What is the difference between HttpServlet and GenericServlet?
Answer:
GenericServlet has a service( ) method aimed to handle requests. HttpServlet extends GenericServlet and adds support for doGet( ), doPost( ), doHead( ) methods (HTTP 1.0) plus doPut( ), doOptions( ), doDelete( ), doTrace( ) methods (HTTP 1.1). Both these classes are abstract.

Question 318.
What is the difference between doGet() and doPostO?
Answer:
doGet( ) method is limited with 2k of data to be sent, and the doPost( ) method doesn’t have this limitation. A request string for doGet( ) looks like the following: http://www.server.com/servlet7param l=valuel&param2=value2&…&paramN=valu eN
doPost(  ) method call doesn’t need a long text tail after a servlet name in a request. All parameters are stored in a request itself, not in a request string, and it’s impossible to guess the data transmitted to a servlet only looking at a request string.

Question 319.
What are the methods in HttpServlet?
Answer:
Methods of HttpServlet can be divided into 3 groups:

1. Initialization methods. These methods are inherited from GenericServlet interface. They include init (ServletConfig config) (allowing initializing a servlet with the prepared or existing config), ServletConfig getServletConfig( ) I (the opposite method), destroy( ) (removing a servlet), ServletContext getServletContext( ) (to obtain the context of a servlet), log methods (logging
| servlet operations).

2. Request processing methods. These are the methods listed in point 2 of this document plus get the last modified(HttpServletRequest request) method.

3. Programmer-defined methods. These methods are written by a programmer and are not regulated by Sun’s Servlet specification.

Question 320.

Why do you need to use session tracking?
Answer:

Session tracking becomes necessary when you are exchanging any information with the visitor and don’t want to lose this information. Session tracking j is the most convenient and easy way of unique client identification.

Question 321.
What are the types of session tracking?
Answer:
There are 4 types of session tracking: using cookies for identifying a client (reading a cookie each time a page is requested), using URL rewriting mechanism (appending the session id to each URL), using SSL built-in session tracking mechanisms, and hiding the session information in hidden fields of an HTML form (e.g. login name).

Question 322.
What are cookies? Why are cookies widely used?
Answer:
Cookies are little (up to 4k) pieces of text stored by the server on a client’s machine. Cookies are a standard way to store persistent session information (shopping cart, client’s preferences, etc.). Every Web server supports cookies, and more than 80% of clients keep cookies options turned on in their Internet browsers.

Question 323.
What will happen if my servlet attempts to write a cookie to the client’s machine, and his browser doesn’t accept cookies?
Answer:
Nothing will happen except you will be unable to read this cookie from a client.

Question 324.
Can I use JavaScript in servlets?
Answer:
You can include JavaScript code to the servlet response (i.e. to the generated page), but not to the servlet code itself.

Question 325.
What are the types of protocols used in HttpServlet?
Answer:
HttpServlet class was developed for usage with HTTP and HTTPS protocols.