Your Ad Here

Saturday, January 3, 2009

Recent - JAVA Interview Questions & Answers

Q : What is the difference between Java platform and other platforms?
A : The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.

The Java platform has two components:

1. The Java Virtual Machine (Java VM)

2. The Java Application Programming Interface (Java API)

Q : What is Java Virtual Machine?

A : The Java Virtual Machine is a software that can be ported onto the various hardware-based platforms.

Q : What is the package? Define with an example?

A : A package is a grouping of related types providing access protection and name space management. Note that types refers to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces.

Package is a directory of related classes and interfaces.
Eg: java.lang.*

Here java is a directory,lang stands for language & it is a sub directory, * indicates collection of related classes & interfaces

Q : What is the difference between the interface and abstract class?
A : An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.

Q : What is the thread?
A : A thread is an independent path of execution in a system.

Q :What is the multi-threading?
A: Multi-threading means various threads that runs in a system.

Q : What is the synchronization ? why is it important in Java Programming?
A : With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is an possible for one thread to modify a shared object while another thread is in the process of using or updating that object’s value. This often causes dirty data and leads to significant errors.

Q : What is the purpose of Runtime class in Java Programming?
A :The purpose of Runtime class is to provide access to the Java runtime system in Java Programming.

Q :Describe difference between a static and a non-static inner class in Java Programming?
A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any other object instances.

Q : Name the primitive Java types?
A : The primitive types are,

byte, char, short, int, long, float, double, and boolean.

Q : What is the casting in Java Programming?
A : There are two types of casting, casting between primitive numeric types and casting between object references.
Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer the object by a compatible class, interface, or array type reference.

Q : What are the Encapsulation, Inheritance and Polymorphism?
A : Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse.
Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions.

Q : What is the difference between constructor and method?
A : Constructor will be automatically invoked when an object is created where as the method has to be called explicitly.

Q: What is a UNICODE?-
A : A Unicode is used for internal representation of characters and strings and it uses 16 bits to represent each other.

Q : What is a abstract class?
A :A abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete.

Q : What is daemon thread ? which the method is used to create the daemon thread?-
A: Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system.

SetDaemon method is used to create a daemon thread.

Q: What are the wrapper classes?
A : The Wrapper classes are classes that allow primitive types to be accessed as objects.

Q : What is the difference between applet and a servlet?
A : Servlets are to servers what applets are to browsers.
Applets must have graphical user interfaces whereas servlets have no graphical user interfaces.

Q :What are the cookies ?
A : Cookies are a mechanism that a servlet uses to have a client hold a small amount of state-information associated with the user.

Q :What is Java Bean?
A : Java Bean is a software component that has been designed to be reusable in a variety of different environments.

Recent HTML Interview Questions & Answers

Q : What’s the difference between the HTML form methods GET and POST?
A : The method parameter specifies which method the client is using to send information to the WEB server. The method determines which parameter you will search the CGI request data in:
* POST - post_args
* GET - http_search_args

Q : What is a tag?
A : In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for many reasons -- to change the appearance of text, to show a graphic, or to make a link to one page to another page.

Q : What are meta tags and why it is used?
A: Html tag in the header section of a web page, intended to offer content to search engines. Among them are the keyword and description tags, but these days are most true search engines de-emphasize or completely ignore META tags. ...

Q : What are the differences between DIV and SPAN?
A : DIV is used to select a block of text so that one can apply styles to it. SPAN is used to select inline text and let users to apply styles to it. The main difference between DIV and SPAN is SPAN does not do formatting by itself. Also the DIV tag is used as a paragraph break as it creates a logical division of the document in which it is applied. This is in contrast to the SPAN as SPAN simply dos the functionality of applying the style and alignment whatever was specified in it. DIV has ALIGN attribute in it which is not present in case of SPAN. Thus DIV is used in cases where one wants to apply styles to a block of text. But there may be situations in which that the there might not be clear well structured block of text to work with. In those cases one can do opt to apply SPAN which is used to apply styles inline. That is in other words DIV is generally used for block of text and SPAN is generally used for words or sentences.

Q : How do you change the title of a framed document?
A : The title displayed is the title of the frameset document rather than the titles of any of the pages within frames. To change the title displayed, a link to a new frameset document using
TARGET="_top" (replacing the entire frameset).

Q : How do you link to a location in the middle of an HTML document?
A : First, label the destination of the link. The old way to label the destination of the link was with an anchor using the NAME attribute.
For example:

Section 2: Web Page



The modern way to the label destination of the link is with an ID attribute.
For example:

Section 2: Web page



Second, link to the labeled destination. The URL is the URL of the document, with "#" and the value of the NAME or ID attribute appended. Continuing the above examples, elsewhere in the same document you could use:
go to Section 2

Q : How do you remove the border around frames?
A : Removing the border around frames involves both not drawing the frame borders and eliminating the space between the frames. The most widely supported way to display borderless frames is FRAMESET ... BORDER=0 FRAMEBORDER=0 FRAMESPACING=0".
Note that these attributes are proprietary and not part of the HTML 4.01 specifications. (HTML 4.01 does define the FRAMEBORDER attribute for the FRAME element, but not for the FRAMESET element.) Also, removing the border around a frame makes it is difficult to resize it, as this border is also used in most GUIs to change the size of the frame.

Q : Explain in brief about the term CSS.
A : A stylesheet language is used to describe the presentation of a document written in a markup language. Cascading Style Sheets are a big breakthrough in Web design because they allow developers to control the style and layout of multiple Web pages all at once.

Q : What are the attributes that make up a DHTML?
A : DHTML is called as a Dynamic HTML. This is used to increase the interactive ability and the visual effect of the web pages which is loaded in the browser. The main technologies that are used in DHTML are namely:

HTML
JavaScript
CSS which is also called as Cascading Style Sheet
DOM also called as Document Object Model

Let see the DHTML namely briefly about

HTML:
This is also known as hyper text markup language. This is widely used in web pages. This along with JavaScript plays a vital role for enhancing the features of web pages. In other words the JavaScript is inside the HTML page and this is read by the browser as soon as the page gets loaded.

JavaScript:
JavaScript is the most popularly used scripting language for client-side. The use of JavaScript within the HTML page adds interactivity ability to web pages and this was introduced by Netscape.


DOM:
DOM is called as Document Object Model. This is platform and also language independent. This is used for dynamic access and updating of contents in documents


CSS:
CSS is called as Cascading Style Sheet. This is used to enhance the features of web pages like formatting styles say bold, font size and so on and there by increase the visual appearance of web pages. These are specified inside an HTML tag.

Q : Why is there extra space before or after the table?
A : This is often caused by invalid HTML syntax. Specifically, it is often caused by loose content within the table (i.e., content that is not inside a TD or TH element). There is no standard way to the handle loose content within a table. Some browsers display all loose content before or after the table. When the loose content contains only multiple line breaks or empty paragraphs, then these browsers will display all this empty space before or after the table itself.
The solution is to fix the HTML syntax errors. All content within a table must be within a TD or TH element.

Q : What’s the difference between jscript and javascript?
A : JScript & javascript are both scripting languages that facilitate
development of web pages. It is similar to javascript with subtle difference in objects & functions exposed. JScript is supported and shipped by Microsoft and may be work best only on IE where as Javascript was initiated by netscape and can do work across all browsers consistently

J2EE Interview questions & answers

Q : what is J2EE ?what is the features?
J2EE is java to enterprise edition. It is used to develop web applications

Q : Define Hash table?
Hash tables are good for doing a quick search on things.
For instance if we have an array full of data (say 100 items).If we known the position that a specific item is stored in an array, then we could quickly access it. For instance, we just happen to know that the item we want it is at position 3; I can apply:
myitem=myarray[3];
There are many different hash functions. Some hash functions will take an integer key and turn it into an index. A common one is used to the division method

Q : what is the difference between web server & application server ?
A : web server can have only the web container. But Application server can have web container as well as EJB container
Example of Application Server : JBOSS
Web Server : TOMCAT.

Q : What are the components of J2EE application?
A : 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

Q : What is a J2EE component ?
A : A self-contained functional software unit supported by the 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 (EJB) 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 a J2EE specification, and deployed to production, where they are run and managed by the J2EE server or client container.

Q : What is "applet"?
A: A J2EE component that is a typically executes in a Web browser but can execute in a variety of other applications or devices that support the applet programming model.

Q : Difference between RMI and EJB?
A : EJB uses RMI technology.
We have to declare the middleware services needed by the EJB in a descriptor.
The Applet server will generate stubs for the same.

RMI : one has to write the middleware services. (txn mgmt, persitence.)

EJB cannot be invoked directly by the remote clients because there are not network enabled.
Location transparency.

Q : What is a web container?
A :Runtime environment for servlets and JSP
Manages lifecycle of instances
Supports HTTP

Q : What’s the difference between URL Connection instance and URL instance?

A : URL Connection instance represents a link for accessing or communicating with the resource at the location and a URL instance represents the location of a resource.

Q :What technologies are included in J2EE?

A :The primary technologies in J2EE are: Enterprise JavaBeansTM (EJBsTM), JavaServer PagesTM (JSPsTM), Java Servlets, the Java Naming and Directory InterfaceTM (JNDITM), the Java Transaction API (JTA), CORBA, and the JDBCTM data access API.

Q : What is XLink ?
A : The part of the XLL specification that is concerned with the specifying links between documents.

Q : What is XLL ?

A : The XML Link Language specification, consisting of XLink and XPointer.

Q : What is in-memory replication?
A : The process by which the contents in the memory of one physical m/c is replicated in all the m/c in the cluster is called in-memory replication.
Q : What is a JavaBeans component
A : A JavaBeans class that can be manipulated by tools and composed into the applications. A JavaBeans component must adhere to the certain property and event interface conventions.

Q : What is the J2EE module?
A : The J2EE module consists of one or more J2EE components.For the same container type and one component deployment descriptor of that type

Q : What is a Web resource ?
A static or dynamic object contained in a Web application that can be referenced by a Uniform Resource Locator URL.

Q : What is "application assembler"?
A : A person who combines J2EE components and modules into deployable application units.

Q : What are the four types of J2EE modules?
A : The four types of J2EE modules are
• Application client module
• Web module
• Enterprise JavaBeans module
• Resource adapter module

JDBC Interview Questions & Answers

Q : How can you make the connection?
A : To establish a connection you need to have the appropriate driver connect to the DBMS.
The following line of code illustrates the general idea is :

String url = “jdbc:odbc:Fred”;
Connection con = DriverManager.getConnection(url, “Fernanda”, “J8?);

Q : What are the different types of Statements?
A : There are three types of statements
• Regular statement (use to create Statement method),
• prepared statement (use prepare Statement method)
• callable statement (use to prepareCall)

Q : What are the two major components of JDBC?
A : The two major components of JDBC are Connection Pooling and Data Sources.

Q : What is a metadata?
A : Metadata is data about data.
In context of JDBC, there are two types of metadata.
1. Describing information about the Result set object. i.e, if u have applied a query that fetches some result. This metadata describes information about how many columns have been fetched, their names etc.
2. Second One describes about the database connection

Q : What is the difference between local and global transaction?
A :A transaction is atomic unit of Work. The tasks which are made into the transaction act as a unit which can be executed successfully all, or if at least one task fails to its promise ,then the effect of all the tasks are to be rollbacked. Thus transaction is committed or rolled backed.

Transactions can be divided into two categories.

1.Local Transactions: These transactions are confined to the objects which reside inside one particular JVM.Local transactions in java can be implemented using the JTA api.

2.Global Transactions:These transactions may encapsulate objects which are distributed on various JVM's.Global transactions are implemented through the TWO-PHASE-COMMIT design implementation.

Q : How to call a Stored Procedure from JDBC?

A : The first step is to create a CallableStatement object. As with as a Statement an and PreparedStatement objects, this is done with an open Connection object. A CallableStatement object contains a call to a stored procedure.

E.g.

CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
ResultSet rs = cs.executeQuery();

Q : What is JDBC objects generate SQLWarnings?
A : Connections, Statements and ResultSets all have a getWarnings method that allows retrieval. Keep in mind that the prior ResultSet warnings are cleared on each new read and prior Statement warnings are cleared with each new execution. getWarnings() itself does not clear existing warnings, but each object has a clearWarnings method.

Q : What are the two major components of JDBC?
A :The two major components of JDBC is One implementation interface for the database manufacturers, the other implementation interface for application and applet writers.

Q : Which is the following statements is true regarding the two tier model of the JDBC driver model?

A : A JDBC driver is required to the communicate with the particular database management system that is being accessed

Q : Which is the statement below does not correctly defines the difference between ODBC and JDBC?
A : ODBC requires manual installation of the ODBC driver manager and driver on all client machines. While for JDBC driver is written in Java and JDBC code is automatically installable, secure and portable on all platforms.
Explanation: Because ODBC being a C based interface cannot be directly used with java.

Q : How web server is connected with appliction server?
A : All the application server needs to the information about the installed web server's port and name, through these entries it creates a connector and stored. This connector is used to communicate with Application server.

Q : What’s the difference between Rowset and Resultset?
A : RowSets are a part of JDBC 2.0 API, and there are quite a few implementations to suit your needs (CachedRowSet, JDBCRowSet, WebRowSet). Essentially a row set is a JavaBean that contains database data. The implementation is store the data offline, or it can simply wrap a connection to make a result set look like a JavaBean. You could even use a row set to access data communicating over HTTP to a servlet, which provides the data for the bean.

Q : How can I insert images into a Mysql database?
A : This code is snippet shows the basics:

File file = new File(fPICTURE);
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps =
ConrsIn.prepareStatement("insert into dbPICTURE values (?,?)");

ps.setString(1,file.getName());
ps.setBinaryStream(2,fis,(int)file.length());
ps.close();
fis.close();

Q : What is the advantage of using a PreparedStatement?
A : For SQL statements that are executed repeatedly, using a PreparedStatement object would almost always be s faster than using a Statement object. This is because creating a PreparedStatement object by explicitly giving the SQL statement causes the statement to be precompiled within the database immediately. Thus, when the PreparedStatement is later executed, the DBMS does not have to recompile the SQL statement and prepared an execution plan - it simply runs the statement.
Typically, PreparedStatement objects are used for the SQL statements that take parameters. However, they can also be used with repeatedly executed SQL statements that do not accept parameters.

Q : How does the JDBC work?
A : The Java Database Connectivity (JDBC) is used to whenever a Java application should communicate with a relational database for which a JDBC driver exists. JDBC is part of the Java platform standard; all visible classes used in the Java/database communication are placed in package java. SQL

Main JDBC classes:
• DriverManager. Manages a list of database drivers. Matches connection requests from the java application with the proper database driver using communication subprotocol. The first driver that recognizes a certain subprotocol under jdbc (such as odbc or dbAnywhere/dbaw) will be used to establish a database Connection.
• Driver. The database communications link, handling all communication with the database. Normally, once the driver is loaded, the developer need not call it explicitly.
• Connection. Interface with all the methods for contacting a database
• Statement. Encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
• ResultSet. The answer/result from a statement. A ResultSet is a fancy 2D list which encapsulates all outgoing results from a given SQL query.

MYSQL Interview Questions & Answers

Q : What are the advantages of mySQL comparing with oracle?
A : MySql are many advantages in comparison to Oracle.

1 - MySql is Open a source, which can be available any time

2 - MySql has no cost of development purpose.

3 - MySql has most of features , which oracle provides

4 - MySql day by day updating with the new facilities.

5 - Good for small application.

6 – Easy to learn and to become master.

7 - MySql has a good power these days.

Even though MySql having so many advantages, Oracle is best database ever in Software development.

Q : What are two examples of an OLTP environment?
A : The two expels of an OLTP environments are
On Line Banking
On Line Reservation (Transportation like Rail, Air etc.)

Q : What Is a Primary Key?
A : A primary key is a single column or multiple columns is defined to have unique values that can be used as a row identifications.

Q : What Is a Transaction?
A : A transaction is a logical unit of work requested by a user to be applied to the database objects. MySQL server is introduced the transaction concept to allow users to group one or more SQL statements into a single transaction, so that the effects of all the SQL statements in a transaction can be either all committed (applied to the database) or all rolled back (undone from the database).

Q : What are the indexes?
A: An index is an internal structure which is provided quick access to rows of a table based on the values of more than one columns.


Q : What is a foreign key?
A: A foreign key is a constraint associates one or more columns in a table with an identical set of columns on which a primary key has been defined in another table. A foreign key may refer to the primary key of another table or same table.

Q : What is the difference between MyISAM Static and MyISAM Dynamic ?
A: In MyISAM static is all the fields have fixed width. The Dynamic MyISAM table would be include fields such as TEXT, BLOB, etc. to accommodate the data types with various lengths. MyISAM Static would be easier to restore in case of corruption, since even though you might lose some data, you know exactly where to look for the beginning of the next record.

Oracle interview Questions And Answers

Q : Explain in brief about snapshot in oracle?
A : A recent copy of a table or a subset of rows or cols of a table is called as snapshot in oracle. A snapshot is more than one useful in distributed computing environment. We can create snapshot in oracle using command create snapshot. We can specify refresh interval while creating snapshot.

Q : What’s the difference between trigger and stored procedure?

A : Procedure can run only when one call them manually whereas a trigger runs when there is any activity (insert, update, delete) on table on which the trigger is written.

Q :What is a database buffer cache?

A : A Database buffer cache is a component of SGA. It has the responsibility of to cache most recent accessed data. It keeps the transaction in the buffer cache till it is written on the disk.

Q : Explain the difference between a data block, an extent and a segment?

A : A data block is the smallest unit of logical storage for a database object. As objects grow they get chunks of additional storage that are composed of a contiguous data blocks. These groupings of contiguous data blocks are called extents. All the extents are that an object takes when grouped together are considered the segment of the database object.

Q :What is difference between UNIQUE and PRIMARY KEY constraints?

A: A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. Primary Key does not allow the NULL value whereas UNIQUE key allows NULL value.

Q : What are different Oracle database objects?
A : There are many oracle database objects are,
TABLES
VIEWS
INDEXES
SYNONYMS
SEQUENCES
TABLESPACES etc

Q : What is a view?
A : A view is stored procedure based on the one or more tables, it is a virtual table.

Q : What is difference between SQL and SQL*PLUS?
A : SQL*PLUS is a command line tool where as SQL and PL/SQL language interface and reporting tool. It is a command line tool that allows user to type SQL commands to be executed directly against an Oracle database. SQL is a language used to query the relational database (DML,DCL,DDL). SQL*PLUS commands are used to format query result, Set options, Edit SQL commands and PL/SQL.

Q :What are the more common used in pseudo-columns?
A : The most common used pseudo columns are,
SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM

Q : Explain the Oracle cursor : Implicit & Explicit cursors ?

A : Oracle uses work areas called private SQL areas to create SQL statements.
PL/SQL construct to identify the each and every work are used, is called as Cursor.
For SQL queries returning a single row, PL/SQL declares is an all implicit cursors.
For queries that returning more than one row, the cursor needs to be explicitly declared.

Struts Interview Questions & Answers

Q : What are the disadvantages of struts?
A : A Few Disadvantage are mentioned into the below link. Struts have disadvantages mainly on performance of the application. Especially when the using advanced tag like nested-loop etc, Resulting in creating many Forms object then required.

Q : Explain the Struts navigation flow?
Struts Navigation flow is
A request is made from previously displayed view.
The request reaches the ActionServlet which acts as the controller .The ActionServlet Looksup the requested URI in an XML file (Struts-Config.xml) and determines the name of the Action class that has to perform the requested business logic.
The Action Class is performs its logic on the Model Components associated with the Application.
Once The Action has been completed its processing it returns the control to the Action Servlet. As part of its return the Action Class provides a key to determine where the results should be forwarded for presentation.
The request is complete when the Action Servlet responds by forwarding the request to the view, and this view represents the result of the action.

Q : How do we call EJB from Struts?
A : We can call EJB from struts by using the service locator design pattern or by Using initial context with create a home object and getting return remote reference object.

Q : Explain about the token feature in Struts?
A : Use the Action Token methods are to prevent duplicate submits
There are methods built into the Struts action to generate one-use tokens. A token is placed in the session when a form is populated and also into the HTML form as a hidden property. When the form is returned, the token is validated. If validation is failed , then the form has already been submitted, and the user can be apprised.
saveToken(request)
on the return trip,
isTokenValid(request)
resetToken(request)

Q : Why we use the Struts framework in project?
A : If you use struts, there will be only one Servlet which acts as a controller (MVC) pattern. If your web application is very a simple then there is no need to use struts. If the application is big like a any banking application etc, then you should use Struts as it is very robust, makes the things simple. It’s Also has lot of readily available security features etc...


Q : What are the components of Struts?
A : Struts components are categorize into Model, View and Controller:

Model: Components like business logic /business processes and data are the part of model.
View: HTML, JSP are the view components.
Controller: Action Servlet of Struts is part of a Controller components which works as front controller to handle all the requests.

Q : What are the important methods of ActioFormn?

A : The important methods is a ActionForm are : validate() & reset().

Q : What is a ActionMapping?
A : A Action mapping contains all the deployment information is a particular Action bean. This class is to determine where the results of the Action will be sent once its processing is complete.

Q : What’s the difference between Struts 1.0 and Struts 1.1 ?
A : The new features added to Struts1 .1 are
RequestProcessor class .
Method perform() replaced by the execute() in Struts base Action Class .
Changes to web.xml and struts-config.xml.
Declarative exception handling.
Dynamic ActionForms
Plug-ins.
Multiple Application Modules.
Nested Tags.
The Struts Validator
Change to the ORO package
Change to Commons logging
Removal of Admin actions.
Deprecation of the GenericDataSource

Q : What is a Struts?
A : A Struts is a java framework based on Model 2 architecture of JSP or popularly called Model-View-Controller architecture. It’s provides a controller for this architecture.

Q : What are the core classes of Struts?
A : The core basic classes of Struts are Action, ActionForm, ActionServlet, ActionMapping, ActionForward.

Q : How is the Struts control data flow?
A : The Struts control implements the MVC/Layers pattern through the use of ActionForwards and ActionMappings to keep the control-flow decisions out of presentation layer.


Q : What is a ActionServlet?

A : The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of the controller. All the requests to the server goes through the controller. Controller is responsible for the handling all the requests.

Q : In what way Struts relates to J2EE?
A: Struts framework is a built on J2EE technologies (JSP, Servlet, Taglibs), but it is a itself not part of the J2EE standard.

Q : Explain the Struts actions?
A : A Struts action is an instance of a subclass of an Action class, which is implemented by a portion of a Web application and whose perform or execute method returns a forward.

Q : Tell me some demerits of struts?
A: It is a very robust framework and is being used to extensively in the industry. But there are some disadvantages of the Struts:
a) High Learning Curve
b) Harder to learn

Q : What is the term action mapping?
A: Struts provides a number of tag libraries that helps to create a view components easily. These tag libraries are:
Bean Tags: Bean Tags are used to access the beans and their properties.
Logic Tags: Logic Tags provides presentation logics that eliminate the need for scriptlets.
HTML Tags: HTML Tags provides tags for creating the view components like forms, buttons, etc..
Nested Tags: Nested Tags helps to work with the nested context.

JMS Interview Questions & Answers

Q : What is JMS?
A : The Java Message Service is a Java API that allows applications to create and send, receive, and read messages. Designed by Sun and several partner companies, the JMS API defines a common set of interfaces and associated semantics that allow the programs written in the Java programming language to communicate with the other messaging implementations.

Q : What’s the difference between queue and topic?
A : A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for the one-to-one messaging i.e. it
supports Point to Point Messaging.

Q : What is an encryption options are there for sending messages through JMS?
A : Encryption is not handled by the JMS specification. It is left to the JMS provider to implement and provide encryption and decryption of messages. These days, Progress Software’s Sonic MQ is a leading the JMS provider and they have a robust encryption mechanism called Quality of Protection. They also provide an SSL-related feature, which is also has build in encryption.

Q :How does the Application server handle the JMS Connection?
• A : Application server is created the server session and stores them in a pool.
• Connection consumer uses the server session to put messages in the session of the JMS.
• Applications written by Application programmers creates the message listener.
• Server session is the one that spawns the JMS session.

Q : What is point-to-point messaging?
A : A point-to-point message passing is the sending application/client establishes a named message queue in the JMS broker/server and sends messages to this queue. The receiving client registers with the broker to receive the messages posted to this queue. There is a one-to-one relationship between the sending and receiving clients.

Q : What is the advantage of persistent message delivery compared to nonpersistent delivery?
A : If the JMS server experiences a failure, for example, a power outage, any message that it is holding in an primary storage potentially could be lost. With persistent storage, the JMS server is logs every message to secondary storage. (The logging occurs on the front end, that is, as part of handling the send operation from the message producing client.) The logged message is removed from secondary storage only after it has been successfully delivered to all the consuming clients.

Q : What is the difference between the Messaging and Mailing?
A: . Messaging is the way of communicating to the remote machines is using the Message Oriented Middlewares. Message Oriented Middlewares don’t use mailing internally for communication. They create their own channels for communication. Java Mailing is the set of APIs that primarily concerns with the sending of Mail messages through the standard mail protocols.

Q : What is a Stream Message ?
A : A Stream messages are a group of java primitives. It contains the some of convenient methods for reading the data. However the Stream Message prevents reading a long value as a short. This is so because the Stream Message also writes the type of information along with the value of the primitive type and enforces a set of strict conversion rules which actually prevents reading of one primitive type as another.

Q : What is the Role of the JMS Provider?
A : The role of the JMS provider is handles the security of the messages, data conversion and the client triggering. The JMS provider specifies the level of encryption and the security level of the message, the best data type for the non-JMS client.

Q What is the text message?
A : The text messages contains String messages (since being widely used, a separate messaging Type has been supported) . It is useful for exchanging textual data and complex character data like XML.

Q What is an object message ?
A : An Object message contains a group of serializeable java object. So it allows exchange of Java objects between applications. Sot both the applications must be Java applications

Q : What is Map message?
A : A Map message is contain the name of the value Pairs. The values can be of type primitives and its wrappers. The name is a string.

Q What is Byte Message ?
A Byte Messages contains a Stream of uninterrupted bytes. Byte Message contains an array of primitive bytes in it is payload. Thus it can be used for transfer of data between two applications in their native format which may not be compatible with other Message types. It is also to useful the where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client.

Q : What’s the difference between StreamMessage and BytesMessage?
A :The StreamMessage maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. BytesMessage stores the primitive data types by converting them to their byte representation. Thus the message is one the contiguous stream of bytes BytesMessage allows the data to be read using any type. Thus even if your payload contains a long value, you can invoke a method of to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the StreamMessage. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.

Q : How JMS is different from RPC?
A : In RPC the method is invoked the waits for the method to finish execution and return to the control back to the invoker. Thus it is completely synchronous in nature. While in the JMS the message sender just sends the message to the destination and continues it is the own processing. The sender does not wait for the receiver to respond. This is asynchronous behavior.

Q : What is main parts of JMS applications?
A :The main parts of JMS applications are:
ConnectionFactory and Destination
Session
Connection
MessageConsumer
MessageProducer
Message

Your Ad Here