Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers - Order By Rating | ||||
![]() ![]() | ||||
![]() | ||||
| ||||
Ans. Comparable interface is used for single sequence sorting i.e.sorting the objects based on single data member where as comparator interface is used to sort the object based on multiple data members. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. There are seven core modules in spring Spring MVC The Core container O/R mapping DAO Application context Aspect Oriented Programming or AOP Web module | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. The DispatcherServlet configured in web.xml file receives the request. The DispatcherServlet finds the appropriate Controller with the help of HandlerMapping and then invokes associated Controller. Then the Controller executes the logic business logic and then returns ModeAndView object to the DispatcherServlet. The DispatcherServlet determines the view from the ModelAndView object. Then the DispatcherServlet passes the model object to the View. The View is rendered and the Dispatcher Servlet sends the output to the Servlet container. Finally Servlet Container sends the result back to the user. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Spring configuration file is an XML file. This file contains the classes information and describes how these classes are configured and introduced to each other. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. The default scope of bean is Singleton. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. The Spring Framework supports following five scopes - Singleton prototype request session global-session | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. The Spring container is able to autowire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory without using | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. servlet is a small, server-resident program that typically runs automatically in response to user input. A network socket is an endpoint of an inter-process communication flow across a computer network. We can think of it as a difference between door and gate. They are similar as they both are entry points but they are different as they are put up at different areas. Sockets are for low-level network communication whereas Servlets are for implementing websites and web services | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. 1.this is a reference to the current object in which this keyword is used whereas super is a reference used to access members specific to the parent Class. 2.this is primarily used for accessing member variables if local variables have same name, for constructor chaining and for passing itself to some method whereas super is primarily used to initialize base class members within derived class constructor. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. Translation of JSP PageCompilation of JSP PageClassloading (class file is loaded by the classloader)Instantiation (Object of the Generated Servlet is created).Initialization ( jspInit() method is invoked by the container).Reqeust processing ( _jspService() method is invoked by the container).Destroy ( jspDestroy() method is invoked by the container). | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. The jsp scriptlet tag can only declare variables not methods whereas jsp declaration tag can declare variables as well as methods. The declaration of scriptlet tag is placed inside the _jspService() method whereas The declaration of jsp declaration tag is placed outside the _jspService() method. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. The jsp directives are messages that tells the web container how to translate a JSP page into the corresponding servlet. There are three types of directives - page directive include directive taglib directive | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. In GUI programming, an object that can be registered to be notified when events of some given type occur. The object is said to listener? for the events. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. MVC is a Design Pattern that facilititates loose coupling by segregating responsibilities in a Web application 1. Controller receives the requests and handles overall control of the request 2. Model holds majority of the Business logic, and 3. View comprise of the view objects and GUI component | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. A source of possible errors in parallel programming, where one thread can cause an error in another thread by changing some aspect of the state of the program that the second thread is depending on (such as the value of variable). | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. A way of encoding characters as binary numbers. The Unicode character set includes characters used in many languages, not just English. Unicode is the character set that is used internally by Java. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. ThreadFactory is an interface that is meant for creating threads instead of explicitly creating threads by calling new Thread(). Its an object that creates new threads on demand. Using thread factories removes hardwiring of calls to new Thread, enabling applications to use special thread subclasses, priorities, etc. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. The memory pool containing all the reflective data of the java virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas. The Permanent generation contains metadata required by the JVM to describe the classes and methods used in the application. The permanent generation is populated by the JVM at runtime based on classes in use by the application. In addition, Java SE library classes and methods may be stored here. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. The Permanent Generation (PermGen) space has completely been removed and is kind of replaced by a new space called Metaspace. The consequences of the PermGen removal is that obviously the PermSize and MaxPermSize JVM arguments are ignored and you will never get a java.lang.OutOfMemoryError: PermGen error. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. You can put related classes together as a single logical group. Nested classes can access all class members of the enclosing class, which might be useful in certain cases. Nested classes are sometimes useful for specific purposes. For example, anonymous inner classes are useful for writing simpler event-handling code with AWT/Swing. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. The accessibility (public, protected, etc.) of the static nested class is defined by the outer class. A static nested class is not an inner class, it's a top-level nested class. The name of the static nested class is expressed with OuterClassName.NestedClassName syntax. When you define an inner nested class (or interface) inside an interface, the nested class is declared implicitly public and static. Static nested classes can be declared abstract or final. Static nested classes can extend another class or it can be used as a base class. Static nested classes can have static members. Static nested classes can access the members of the outer class (only static members, obviously). The outer class can also access the members (even private members) of the nested class through an object of nested class. If you don't declare an instance of the nested class, the outer class cannot access nested class elements directly. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. The accessibility (public, protected, etc.) of the inner class is defined by the outer class. Just like top-level classes, an inner class can extend a class or can implement interfaces. Similarly, an inner class can be extended by other classes, and an inner interface can be implemented or extended by other classes or interfaces. An inner class can be declared final or abstract.Inner classes can have inner classes, but you will have a hard time reading or understanding such complex nesting of classes. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. You can create a non-static local class inside a body of code. Interfaces cannot have local classes, and you cannot create local interfaces. Local classes are accessible only from the body of the code in which the class is defined. The local classes are completely inaccessible outside the body of the code in which the class is defined. You can extend a class or implement interfaces while defining a local class. A local class can access all the variables available in the body of the code in which it is defined. You can pass only final variables to a local inner class. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. That would not be a problem as both are specifying the contract that implement class has to follow. If class C implement interface A & interface B then Class C thing I need to implement print() because of interface A then again Class think I need to implement print() again because of interface B, it sees that there is already a method called test() implemented so it's satisfied. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Arrays provide a structure wherein multiple values can be accessed using single reference and index. This helps in iterating over the values using loops. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Arrays are of fixed size and have to reserve memory prior to use. Hence if we don't know size in advance arrays are not recommended to use. Arrays can store only homogeneous elements. Arrays store its values in contentious memory location. Not suitable if the content is too large and needs to be distributed in memory. There is no underlying data structure for arrays and no ready made method support for arrays, for every requriment we need to code explicitly | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Class.getInstance doesn't call the constructor whereas if we create an object using new operator , we need to have a matching constructor or copiler should provide a default constructor. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Yes , using Class.getInstance. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Cloneable is a declaration that the class implementing it allows cloning or bitwise copy of it's object state. It is not having any method because it is a MARKER interface. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. When you expect your code will be accessed by different threads and these threads may change a particular data causing data corruption. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
![]() ![]() | ||||