Your Ad Here
Showing posts with label j2me. Show all posts
Showing posts with label j2me. Show all posts

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.

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

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

Wednesday, December 31, 2008

XML Interview Questions & Answers

Q : How can u create an XML file?
A : It is a quite easy to create, can create by the plain text editor like notepad or by .net model using so many in built methods like XmlTextWriter etc.

Q : What is a XML Namespace?
A : Defining a namespace to avoid the confusion involves using a prefix and adding an xmlns attribute to the tag to give the prefix a qualified name associated with the namespace. All the child elements with the same prefix are associated with the namespace defined in the start tag of an element.

Q : What’s the difference between SAX parser and DOM parser?
A : SAX parser - works incrementally and generate the events that are passed to the application. It does not generate data representation of xml content so some programming is required. However, it provides the stream processing and partial processing which cannot be done alone by DOM parser.
DOM parser - reads the whole XML document and returns a DOM tree representation of xml document. It provides a convenient way for reading, analyzing and manipulating XML files. It is not well a suited for the large xml files, as it always reads the whole file before processing.

Q : Describe the differences between XML and HTML?
A : XML :
• User definable tags
• Content driven End tags required for well formed documents
• Quotes required around attributes values
• Slash required in empty tags

HTML :
• Defined set of tags designed for web display
• Format driven
• End tags not required
• Quotes not required
• Slash not required

Q : What is DOM?
A : The Document Object Model (DOM) is an interface specification maintained by the W3C DOM Workgroup that defines is an application independent mechanism
to access, parse, or update XML data. In the simple terms it is a hierarchical model that allows developers to manipulate XML documents easily.

Q :Why is XML such an important development?
A : XML removes the two constraints which were holding the back Web developments: dependence on a single, inflexible document type (HTML); the complexity of full SGML.

Q : What is a XPointer?
A : XPointer is a set of recommendations developed by the W3C. The core recommendations are the XPointer Framework which provides an extensible addressing behavior for fragment identifiers in XML media types.
XPointer gains its extensibility through the XPointer Framework, which identifies the syntax and processing architecture for XPointer expressions and through an extensible set of XPointer addressing schemes. These schemes, e.g., element() or xpointer(), are actually QNames. The xmlns() scheme makes it possible for an XPointer to declare namespace bindings and thereby the use third-party schemes as readily as W3C defined XPointer schemes.

Q : What is the three essential components of security does the XML Signatures provide?
A : Authentication, message integrity, and non-repudiation. In addition to signature information, an XML Signature can also contain the information describing the key used to sign the content.

Q :What’s an XML namespace prefix?
A : An XML namespace prefix is a prefix used to specify that a local element type or attribute name is in a particular XML namespace.

Q : Why is XML such an important development?
A : XML removes the two constraints which were holding back Web developments:
1. Dependence on a single, inflexible document type (HTML) which was being much abused for tasks it was never designed for;
2. The complexity of full SGML, whose syntax allows many powerful but hard-to-program options.
XML allows the flexible development of user-defined document types. It provides a robust, non-proprietary, persistent, and verifiable file format for the storage and the transmission of text and data both on and off the Web, and it’s remove the more complex options of SGML, making it easier to program for.

J2ME Interview Questions & Answers

Q : What is J2ME ?
A : Java 2 Micro Edition(J2ME) is a group of specifications and technologies that pertain to Java on small devices. The J2ME moniker covers a wide range of devices, from the pagers and mobile telephones through the set-top boxes and car navigation systems. The J2ME world is divided into the configurations and profiles, specifications that describe a Java environment for a specific class of device.

Q : What is the Generic Connection Framework ?
A : The Generic Connection Framework (GCF) makes it is very easy for wireless devices to make the network connections. It is part of a CLDC and CDC and resides in the javax.microedition.io package.

Q : What is a RMI ?
A : Remote method invocation (RMI) is a feature of J2SE that enables to the Java objects running in one virtual machine to invoke the methods of Java objects running in another virtual machine, seamlessly.

Q : What’s WDP?
A : Wireless Datagram Protocol (WDP)is worked as the transport layer of WAP. WDP processes datagrams from the upper layers to formats required by the different physical datapaths like GSM SMS or CDMA Packet Data. WDP is adapted to the bearers available in the device so upper layers do not need to the care about the physical level.

Q : What is JCP ?
A : The Java Community Process (JCP) is an open the organization of international Java developers and licensees who develop and revise Java technology specifications, reference the implementations, and technology compatibility kits through a formal process.

Q : What is a OTA ?
A : Over The Air (OTA) refers to any the wireless networking technology.

Q : What is kXML ?
A : The kXML project provides a small of footprint XML parser that can be used with the J2ME.

Q : What is PCS ?
A : Personal Communications Service (PCS) is a suite of second-generation, digitally modulated mobile-communications the interfaces that includes TDMA, CDMA, and GSM. PCS serves as an umbrella term for the second-generation wireless technologies operating in the 1900MHz range.

Q :What is the Personal Profile ?

A The Personal Profile is a J2ME profile the specification. Layered on the Foundation Profile and CDC, the Personal Profile will be the next generation of PersonalJava technology. The specification is currently in development under the Java Community Process (JCP).

Q : What is TDMA ?
A: Time Division Multiple Access (TDMA) is a second-generation modulation standard using bandwidth the allocated in the 800 MHz, 900 MHz, and 1900MHz ranges.

Q : What is WTLS ?
A : Wireless Transport Layer Security protocal (WTLS) does all cryptography oriented features of WAP. WTLS handles encryption/decryption, user authentication and data integrity. WTLS is based on the fixed network Transport Layer Security protocal (TLS), formerly known as Secure Sockets Layer (SSL).

Q : What ‘s WTP ?
A : Wireless Transaction Protocol (WTP) is WAP's transaction protocol that works between the session protocol WSP and security protocol WTLS. WTP chops data packets into lower level datagrams and concatenates received datagrams into useful data. WTP also keeps track of received and sent packets and does re-transmissions and acknowledgment sending when needed.

Q : What is WMLScript
A : WMLScript is a subset of the JavaScript scripting language designed to as part of the WAP standard to provide a convenient mechanism to access the mobile phone's peripheral functions.

Sunday, December 28, 2008

C++ Interview Questions & Answers

Q : How do youn delete an element in array of string?

A : Reduce the array size.

if(stringarryname)

{

delete[] stringarryname;

delete stringarryname;

stringarryname = NULL;

}


Q : What is the difference between an overload assignment operator and an a copy constructor?

A :. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class. A copy constructor constructs a new object by using the content of the argument object


Q :What is the virtual destructor?

A : The virtual destructor is one that is declared with the virtual attribute.

The behavior of a virtual destructor is what is important. If you destroy an object through a baler or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be compile.

Q: What is the Difference between C and C ++?

A : C is a structured programming language. The C++ is an object oriented language. C++ is also called as C with Classes.

both C and C++ are programming languages. C++ is termed as superset of C.
C is a powerful and elegent language.almost all c PROGRAMS ARE ALSO c++ PROGRAMS. C, it facilitates--" topdown structured design" as against C++ provides bottom-up object-oriented design. C language is built from functions (like printf)that execute different tasks.

Q : Difference between a template class and class template in C++?

A : Template class: A generic definition or a parametrized class not instantiated until the client provides the needed information. It is the jargon for plain templates.
Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It is jargon for plain classes.

Q : What is the polymorphism in C++?

A : Polymorphism in the C++ is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and base class array can store different child class objects.

Your Ad Here