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

Saturday, January 3, 2009

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.

Wednesday, December 31, 2008

Recent C# Interview Questions & Answers

Q : What is the C# syntax to catch any possible exception?
A : A catch block is that the catches the exception of type System .Exception. You can also omit the parameter data type in this case and just write catch {}.

Q :What is the difference between System.String and System.Text.StringBuilder classes?
A : System.String is a immutable. System.StringBuilder was designed with the purpose of having a mutable the string where as a variety of operations can be performed.

Q : What’s the syntax to inherit from a class in C#?
A: A Place is a colon and then the name of the base class.
Example: class MyNewClass : MyBaseClass

Q : When do you correctly have to declare a class as abstract?
A : When the class itself is the inherited from an abstract class, but not all base abstract methods have been overridden.
When at least one of the methods in the class is abstract class.

Q : What’s the difference between a Struct and a Class?
A : Structs are the value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is struct can not inherit.

Q :What are the different ways of method can be overloaded?
A: There are three types of ways can be overloaded,
Different parameter data types,
Different number of parameters,
Different order of parameters.

Q : Which is the following is used to denote comments in C#?
A : All are correct, all are supported forms of commenting. It is just that /// is specifically for functionality in XML documentation.

Q : What is true about readonly variable in C# code?

A : B is the right choice. Since readonly field can only be initialized at the time of
construction of the object. Read only means if you want to initialize the readonly property that intialize it inside the constructor.

Q : What’s an interface class?
A : It is an abstract class with the public abstract methods all of which is must be implemented in the inherited classes.

Q : What is a delegate?
A : A delegate is a object encapsulates a reference to a method. In C++ they were referred to as function pointers.

Q : What is a multicast delegate?
A Multicast delegate is that points to and eventually fires off several methods.

Q : What is the difference between the Trace class and Debug class?
A :Documentation looks the same. Use Debug class for debug builds, use the Trace class for both debug and release builds.

Q : What is Inheritance?
A :Inheritance is a process of acquiring attributes and behaviors from the another object (normally a class or interface). Gives you ability to provide is-a relationship. Acquires attributes and behaviors from another. When a class acquires attributes and behaviors from another class.

Q : What is a Destructor?
A : A destructor is a deallocating the memory.

Q : How a base class method is hidden?
A : Hiding a base class method by declaring a method in the derived class with keyword new. This will override the base class method and old method will be suppressed.

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

Recent C++ Interview questions & Answers

Q : Explain in void pointer using C++?
A : In C++, void represents the absence of type, so void the pointers are pointers that point to a value that has no type. The void pointers can point to any data type.
We can declare void pointer as follows.
Void *p;

Q : What is the function overloading in C++?

A : You can have the multiple functions with same name using function overloading facility of C++. You can use same name for multiple functions when all these functions are doing same thing.

Q : What is virtual function?
Answer - Virtual function is the member function of a class that can be overridden in its derived class. It is declared with virtual keyword. Virtual function call is resolved at run-time (dynamic binding) whereas the non-virtual member functions are resolved at compile time (static binding).

Q : What is Null object in C++?
A : Null Object is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member of function that is supposed to return an object with some specified properties but cannot find such an object.

Q : What is virtual function? where is it used?
A : Virtual function is a member of function that is declared by with in a base class and redefined by the derived class. to make a function virtual prefix the function name by the "virtual" keyword. It helps in polymorphism.

Q : what is a template
A template function defines a set of operations to performed on the various data types This data is passed to the function as an argument

Q : What do you mean by the inheritance?
A : The Inheritance is the process by which one can aquire the properties of another object

Q : Explain the scope resolution operator?
A: The scope resolution operator is a permits of a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.

Q : What is parameterized type?
A : : A template is a parameterized construct or type containing the generic code that can use or manipulate any type. It is called the parameterized because an actual type is a parameter of the code body. Polymorphism may be achieved through parameterized types. This type of polymorphism is called parameteric polymorphism. Parameteric polymorphism is the mechanism by which the same code is used on different types passed as parameters.

Q : Explain the scope resolution operator?
A :Resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.

Q : Name of the some pure object oriented languages?
A : Some pure object oriented languages are
• Smalltalk,
• Java,
• Eiffel,
• Sather.

Q : Differentiate between a C++ struct and C++ class?
A : The default member and base-class access specifies are different. This is one of the commonly misunderstood aspects of C++. Believe it is or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specified and private base-class inheritance.

Q : Why do C++ compilers need the name mangling?
A : Name mangling is the rule of according to which is the C++ changes function's name into function signature before the passing that the function to a linker. This is how the linker differentiates between different functions with the same name.

Q : What is protocol class?
A : An abstract class is a protocol class if:
1.Protocol neither contains nor inherits from the classes that contain member data, non-virtual functions, or private (or protected) members of any kind.
2. It has a non-inline virtual destructor defined with an empty implementation,
3. All member functions other than the destructor including inherited functions, are declared pure the virtual functions and left undefined.

Q : What is the difference between the message and method?
A: Method: Provides response to a message.It is an implementation of an operation..
Message: Objects communicate by sending the messages to each other.A message is sent to invoke a method.]

Q : What is an adaptor class ?
A : A class that has no functionality of its own. It is the member functions hide the use of a third party software component or an object with the non-compatible interface or a non- object- oriented implementation.

Q : What’s the difference between char a[] = “string”; and char *p = “string”;?
A : In the first case six bytes are allocated to the variable in a which is fixed, where as in the second case if *p is assigned to the some other value the allocate memory can change.

Q : What is conversion constructor?
A : A conversion constructor is that accepts one argument of a different type.

Q : What’s an explicit constructor?
A : A conversion constructor declared with the explicit keyword. The compiler does’nt use an explicit constructor to implement an implied conversion of types. It is the purpose of is reserved explicitly for construction.

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.

Recent Data Structure Interview Questions & Answers

Q : What’s the purpose of a left child node and a right child node?
A : The left child node and right child node helps in sorting technology because parent will be having larger value than that of left and left child will be having larger value than that of right.

Q : What is the advantage of using a queue linked list?
A : The Most Important is CPU Scheduling , refers a Queue for scheduling.
Queue is to Faster then Other One(stack)

Q : What is linked list?
A : Linked list is a data structure which is contain the data elements and a pointer of the node type of which points to the next node in the linked list. It is useful when you do not know in advance how many elements will be there so you cannot pre allocate space (e.g. using an array).

Q : Which data structure is used to perform the recursion?
A : Stack has the LIFO (Last In First Out) property; it remembers it is a ‘caller’. Therefore, it knows as to whom it should return when the function has to return. On the other hand, recursion makes use of the system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative (non-recursive) function. Even when such the equivalent is iterative procedures are written explicit, stack is to be used.

Q : What are some of the applications for the tree data structure?
A : There are three types of the application for the tree data structure,
• Symbol table construction.
• Manipulation of the arithmetic expressions.
• Syntax analysis

Q : What is spanning Tree?
A : A spanning tree is a tree associated with a network. All the nodes are the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.

Q : What’s the difference between STACK and ARRAY?
A : In array the items can be entered or removed in any order. Basically each member access is done using the index. No strict order is to be followed here to remove a particular element. STACK follows LIFO. Thus the item that is first entered would be the last removed.

Q : What is the method removes the value from the top of a stack?
A : The pop() member method removes the value from the top of a stack, which is then returned by the pop() member method to the statement that is called the pop() member method.

Q : What is queue ?
A : A Queue is a sequential organization of data. A queue is a FIFO type of data structure. An element is an inserted at the last position and an element is always taken out from the first position.

Q : Difference between malloc and calloc ?
A : calloc: allocate the m times n bytes initialized to 0
malloc: allocate the n bytes.

Q : what is an abstract data type?
A : Abstract data type is a logical cohesion of operands or variables along with a set of operation which can be performed on it. In Java we have most of data types as abstract data types. It helps in implementing the oops concept of encapsulation, abstraction, modularisation. Eg :String data type in java is an abstract data type. String is defined as a character array data member of a class All operations related to or which can be performed on strings are included as methods of the class.

Q : What’s the difference between bubble sort & quick sort?
A : Bubble sort is a very easy to program, slower, iterative. Compares neighboring numbers swaps it if required and continues this procedure until there are no more swaps
Quick Sort is a little difficult to program, Fastest, Recursive. Pivot number is selected, other numbers are compared with it and shifted to the right of number or left depending upon criteria again this method is applied to the left and right list generated to the pivot point number. Select pivot point among that the list.

Q : What is linear and non-linear data structures?
A : Linear data structure is an array, linked list
Non linear data structure is a tree, graph

Q : What is user-defined data type?

A : A user defined data type is a structure of which contains variables of basic data types.
For (ex) user can define a data type called employee which contains variables like string EmpName, int DeptNo, float Salary etc.

Your Ad Here