If you are a Java Expert then this is for you. Let us know if you looking for a job change? Then do not worry, we’ve an answer for your job interview preparation. If you are preparing for Java, J2ee, Spring, Ajax job interview and don’t know how to crack interview then go through Wisdomjobs interview questions and answers page to crack your job interview. Java is universal programming language. J2ee is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web services. Spring Framework is an application framework and inversion of control container for the Java platform. Below are the Java, J2ee, Spring, Ajax interview questions and answers which makes you to face the interviews:
Answer :
Ajax is abbreviated as Asynchronous Javascript and XML. It is new technique used to create better, faster and more interactive web systems or applications. Ajax uses asynchronous data transfer between the Browser and the web server.
This technique is used to make internet faster and user friendly. It is not a programming language.
Question 2. What Are Ajax Applications?
Answer :
Browser based applications and platform independent applications are used by Ajax.
Question 3. How Many Types Of Triggers Are Present In Update Panel?
Answer :
There are two types of triggers used in update panel:
PostBackTrigger – This works as full postback and it cannot work asynchronously
AsyncPostBackTrigger – Partial post back asynchronously
Question 4. What Are All The Controls Of Ajax?
Answer :
Following are the controls of Ajax:
Question 5. What Is The Name Of The Dll That Contains Ajax Control Tool Kit?
Answer :
Ajaxcontroltoolkit.dll is the DLL used for Ajax control tool kit and it can be downloaded from the internet. It can be added in the tool box or copied directly in the bin folder.
Question 6. What Role Of #&& In Querystring?
Answer :
# is treated as fragment delimiter to delimit the history state and && precedes is used to check on the information in the query string.
Question 7. How To Control The Duration Of An Ajax Request?
Answer :
AsyncPostBackTimeout property is used to control the duration of Ajax request. Deafult value of this property is 90 seconds.
Example –
<asp:ScriptManager runat=”server” id=”sample” AsyncPostBackTimeout=”40”/>
Question 8. What Are The Advantages Of Ajax?
Answer :
Following are the advantages of Ajax:
Question 9. What Are The Disadvantages Of Ajax?
Answer :
Following are the disadvantages of Ajax:
Question 10. What Is Update Panel?
Answer :
Update panel is a server control used to update the specified portion of a web page. Script Manager needs to be used whenever update panel is used. Using update panel, user cannot handle outside controls.
Question 11. Which Are The Two Methods Used For Cross Domain Ajax Calls?
Answer :
There are two methods used to transfer data between the two more more security domains:
CORS – Cross Origin Resource Sharing and it works with the HTTP web browsers
JSONP – JSON with Padding which works with the HTTP GET and on legacy browsers
Question 12. What Are All The Technologies Used By Ajax?
Answer :
AJAX uses following technologies:
Question 13. What Are All The Features Of Ajax?
Answer :
Following are the features of Ajax and they are as follows:
Question 14. What Is Json In Ajax?
Answer :
Question 15. What Are The Pre-requisites To Execute Ajax Applications On A Server?
Answer :
AJAX is a built-in functionality of .NET Framework 4.0 and AJAX application can be executed by just installing Microsoft Visual Studio 2010. To use extenders in your applications, you are required to install AJAX Control Toolkit and copy the AjaxControlToolkit.dll file to the Bin directory of your application.
Question 16. What Is Ajax Framework?
Answer :
ASP.NET AJAX is a free framework to implement Ajax in asp.net web applications. It is used to quickly creating efficient and interactive Web applications that work across all browsers.
Question 17. How Can You Find Out That An Ajax Request Has Been Completed?
Answer :
ReadyState property is used to check whether AJAX request has been completed. If the property is equal to four, then the request has been completed and data is available.
Question 18. Is Javascript Knowledge Is Required To Do Ajax?
Answer :
Yes, if you plan to develop new AJAX functionality for your web application.
Question 19. What Are All The Browsers Support Ajax?
Answer :
Following browsers support AJAX:
Question 20. How Can You Test The Ajax Code?
Answer :
JSUnit is the client side javascript code used as part of JUnit. JSUnit has been used for Ajax code.
Question 21. Is Ajax Said To Be A Technology Platform Or Is It An Architectural Style?
Answer :
Ajax supports both technology and as architectural style.
Question 22. How Can Ajax Applications Be Debugged?
Answer :
Two tools are used for debugging:
Question 23. How Can We Cancel The Xmlhttprequest In Ajax?
Answer :
Abort() method can be called to cancel the XMLHttpRequest in Ajax.
Question 24. Is Ajax Code Cross Browser Compatible?
Answer :
No, it is supporting cross browser compatible. If the browsers supports native XMLHttpRequest JavaScript object, then this can be used.
Question 25. What Is The Name Of Object Used For Ajax Request?
Answer :
XmlHttpRequest object is used for Ajax requests.
Question 26. What Is Prerequisite For Update Panel In Ajax?
Answer :
Script Manager is pre-requisite to use Update Panel controls.
Question 27. How Many Update Panel Can Be Used Per Page?
Answer :
There are no restrictions on the number of update panels per page.
Question 28. What Is Script Manager?
Answer :
Script Manager helps manage the client side script of AJAX. Script Manager acts as a mediator as AJAX depends on JavaScript. Every page that uses AJAX has a Script Manager to enable AJAX libraries.
Question 29. How Ajax Objects Can Be Created?
Answer :
Following syntax can be used to create Ajax objects:
Var sample = New ajaxObject(‘path of the page’)
Question 30. What Are The Protocols Used By Ajax?
Answer :
Question 31. What Are All The Security Issues Of Ajax?
Answer :
Security issues that can be encountered
Question 32. How Can We Handle Concurrent Requests?
Answer :
Javascript functions should be written to handle concurrent requests and call back function can be passed as a parameter. Those parameters are passed to AjaxInteraction(URL, callback) object.
Question 33. Define The Role Of The Update Panel?
Answer :
Update Panel is used to add functionality to the existing ASP.NET applications. By using partial page rendering, it can be used to update the content. Refresh can be made for the partial page instead of whole page.
Question 34. Can We Use Nested Update Panel In Ajax?
Answer :
Yes, we can use nested update panel in Ajax. Update panels can be nested to have more control over the Page Refresh.
Question 35. What Are The Types Of Post Back In Ajax?
Answer :
There are two types of post backs:
Question 36. How Can We Handle Exception Handling In Ajax?
Answer :
ErrorTemplate which is the child tag of Script Manager is used to handle exception handling in Ajax.
Question 37. What Are The Components Of The Asp.net Ajax Client Library?
Answer :
Following components are used in Ajax client library:
Question 38. What Are The Controls Of The Script Management Group?
Answer :
The controls of script Management group are:
Question 39. What Are All The Different Data Types That Json Supports?
Answer :
JSON supports following data types:
Question 40. What Are The Goals Of Ajax?
Answer :
The basic goals of Ajax are:
Question 41. What Is The Difference Between Proxied And Proxyless Calls In Ajax?
Answer :
Proxied calls are made through stub objects which can be called from PHP classes on the JavaScript side in AJAX.
Proxyless calls are made using utility JavaScript functions like HTML_AJAX.replace() and HTML_AJAX.append() in AJAX.
Question 42. How Many Types Of Ready States In Ajax?
Answer :
There are four ready states in Ajax:
Answer :
Following are the functions:
RegisterClientScriptBlock – The script is specified as a string parameter.
RegisterClientScriptInclude – By setting the source attribute to a URL that point to a script file.
RegisterClientScriptResource – specifies Resource name in an assembly. The source attribute is automatically populated with a URL by a call to an HTTP handler that retrieves the named script from the assembly.
Question 44. Which Request Is Better, Get Or Post?
Answer :
AJAX requests should use an HTTP GET request where the data does not change for a given URL requested.
An HTTP POST should be used when state is updated on the server. This is highly recommended for a consistent web application architecture.
Question 45. What Are The Limitations Of Ajax?
Answer :
An Ajax Web Application tends to confuse end users if the network bandwidth is slow and there is no full postback running.
Question 46. What Is Spring Framework?
Answer :
Spring is one of the most widely used Java EE framework. Spring framework core concepts are “Dependency Injection” and “Aspect Oriented Programming”.
Spring framework can be used in normal java applications also to achieve loose coupling between different components by implementing dependency injection and we can perform cross cutting tasks such as logging and authentication using spring support for aspect oriented programming..
Question 47. What Do You Understand By Dependency Injection?
Answer :
Dependency Injection design pattern allows us to remove the hard-coded dependencies and make our application loosely coupled, extendable and maintainable. We can implement dependency injection pattern to move the dependency resolution from compile-time to runtime.
Some of the benefits of using Dependency Injection are: Separation of Concerns, Boilerplate Code reduction, Configurable components and easy unit testing.
Question 48. What Are Advices In Spring?
Answer :
It is the execution of an aspect. Advice is like making your application learn a new trick. They are usually introduced at joinpoints.
Question 49. What Is The Default Scope Of Bean In Spring Framework?
Answer :
The default scope of bean is Singleton for Spring framework.
Question 50. Name The Types Of Transaction Management That Are Supported By Spring?
Answer :
Transaction management supported by Spring are :
Question 51. Is Singleton Beans Are Thread Safe In Spring Framework?
Answer :
No, singleton beans are not thread-safe in Spring framework.
Question 52. What Are The Benefits Of Spring Framework?
Answer :
Following are the benefits of Spring framework:
Question 53. What Is Bean Factory?
Answer :
Bean Factory is core of the spring framework and, it is a Lightweight container which loads bean definitions and manages your beans. Beans are configured using XML file and manage singleton defined bean. It is also responsible for life cycle methods and injects dependencies. It also removes adhoc singletons and factories.
Question 54. Define Bean Wiring?
Answer :
Bean wiring is the creation of associations between application components that are between the beans in a particular spring container.
Question 55. What Is Called Spring Mvc?
Answer :
A Spring MVC is a single shared controller instance and it is used to handle request type controllers, interceptors which run in the IoC container. It also allows multiple Dispatcher Servlets which can share application context interface but not class based interface.
Question 56. Why Spring Framework Is Needed?
Answer :
Spring framework is needed because it is –
Question 57. Name The Various Modules Used In Spring Framework?
Answer :
Question 58. Explain The Rowcallbackhandler In Spring?
Answer :
The RowCallbackHandler is called for each row in ResultSet and is used to read values from the ResultSet.
Question 59. Define Application Context Module?
Answer :
This is a very important module and supplies various necessary services like EJB integration, remoting, JNDI access and scheduling. It transforms spring into a framework. It also broadens the idea of BeanFactory by application of lifecycle events, providing support for internationalization messages and validation.
Question 60. Write About Aop Module?
Answer :
AOP module is utilized for creating aspects for Spring applications. It also enables support for metadata programming in Spring.
Question 61. What Is A Beanfactory Interface?
Answer :
Bean factory interface is used to provide configuration framework for object creation and basic functionality around object management.
Question 62. What Is Auto Wiring?
Answer :
Autowiring is used to build relationships between the collaborating beans. Spring container can automatically resolve collaborators for beans.
Question 63. What Are The Different Modes Of Autowiring?
Answer :
Autowiring has five different modes:
Question 64. How To Start Using Spring?
Answer :
Following steps needs to be done to start with the Spring:
Question 65. What Are The Methods Of Bean Life Cycle?
Answer :
There are two important methods of Bean life cycle:
Setup – called when bean is loaded into container.
Teardown – called when bean is unloaded into container.
Question 66. What Are The Different Types Of Events Of Listeners?
Answer :
Following are the different types of events of listeners:
ContextClosedEvent – This event is called when the context is closed.
ContextRefreshedEvent – This event is called when context is initialized or refreshed.
RequestHandledEvent – This event is called when the web context handles request.
Question 67. Differentiate Between Singleton And Prototype Bean?
Answer :
Singleton means only one bean is defined per object instance while Prototype means one definition to more than one object instances in Spring.
Question 68. What Are The Types Of Dependency Injection?
Answer :
Two types of dependency injection are supported by spring framework:
Question 69. Write About Core Container Module?
Answer :
Core container module is responsible for the basic functionality of the spring framework. The whole Spring framework is built with this module as a base.
Question 70. What Is Aop Module?
Answer :
This AOP module is used for spring enabled application. Support has been provided AOP alliance to ensure the interoperability between spring and other AOP frameworks.
It instructs spring to add annotations to the source code and tell how to apply aspects.
Question 71. What Is Aop Alliance?
Answer :
AOP alliance is an open-source project which is aimed at promoting adoption of AOP. The AOP alliance’s goal is to define a common set of components and interfaces so as to improve interoperability among different AOP implementations.
Question 72. What Is Called Spring Configuration File?
Answer :
Spring configuration file is an XML file and it contains class information. It also describes how these classes are configured and interact with each other.
Question 73. What Are Different Types Of Autowire?
Answer :
There are four different types of Auto wire:
Question 74. What Are The Types Of The Transaction Management That Is Supported By Spring?
Answer :
Following are the types of transaction management that has been supported by spring:
Question 75. When Are Declarative And Programmatic Transaction Management Used?
Answer :
When only a small amount of transactional operations is there, it is advised to use Programmatic transaction management. But if there is a big amount of transactional operations to be taken care of, declarative transaction management is preferred.
Answer :
IOC (Inversion of Control pattern) is also known as dependency injection. IOC directs the programmers to depict how to create objects instead of actually creating them. But in this design pattern, this control has been given to assembler and assembler will instantiate required class if needed.
Question 77. Write About The Different Types Of Listener Related Events?
Answer :
The different types of events related to listeners are:
Question 78. What Is Called An Advice?
Answer :
Advice will tell application on new behavior and it is the implementation of an aspect. It is inserted into an application at the joinpoint.
Advice is the implementation of an aspect. It is something like telling your application of a new behavior. Generally, the advice is inserted into an application at joinpoints.
Question 79. What Is A Joinpoint?
Answer :
The point where an aspect can be introduced in the application is known as a joinpoint. This point could be a field being modified, a method being called or even an exception being thrown. At these points, the new aspect’s code can be added to introduce a new behavior to the application.
Aspect code can be inserted at this point into normal flow of application to change the current behavior.
Question 80. What Is An Aspect?
Answer :
Aspect is also called as logging which is required throughout the application. Logging or aspect is a cross cutting functionality in an application using AOP.
Question 81. What Is A Pointcut?
Answer :
Pointcut is used to allow where the advice can be applied.
Answer :
Weaving is used to create new proxy object by applying aspects to target object.
Question 83. What Is Difference Between Singleton And Prototype Bean?
Answer :
Singleton Bean – Single bean definition to a single object instance per Spring IOC container
Prototype Bean – Single bean definition to any number of object instances per Spring IOC Container
Question 84. Explain The Term Proxy?
Answer :
The term proxy refers to an object which is produced the application of an advice to the target object.
Question 85. What Is Cross Cutting Concern And Concern In Spring Aop?
Answer :
Cross cutting concern: It is a concern which is applicable throughout the application and it affects the entire application. E.g Security, logging and data transfer are the concerns which are needed in almost every module of an application.
Concern: Concern is a behavior that we want to have in a module of an application. Issues in which we are interested defines our concern.
Question 86. What Is Dataaccessexception?
Answer :
DataAccessException is a RuntimeException. It is an Unchecked Exception. The user cannot be forced to handle these kinds of exceptions.
Question 87. What Is The Web Module?
Answer :
The web module enables the creation of a web application without XML. The web.xml file needs to be configured for using the web module.
Question 88. What Are Orm Integration Modules?
Answer :
Object/relational mapping (ORM) tool is supported by Spring over straight JDBC by implementing the ORM module. Spring can join various important ORM frameworks, including JDO, iBATIS SQL Maps and Hibernate.
Question 89. What Is The Better Method Of Using Jdbc In Spring?
Answer :
If JDBC is used with the template class called JdbcTemplate, it gives a better performance.
Question 90. What Exceptions Do The Dao Classes, Use In Spring Throw?
Answer :
In spring DAO classes only throws SQLException.
Question 91. What Is Javaserver Faces Conversion Model?
Answer :
A mechanism for converting between string-based markup generated by JavaServer Faces UI components and server-side Java objects.
Question 92. What Is Javaserver Faces Event And Listener Model?
Answer :
A mechanism for determining how events emitted by JavaServer Faces UI components are handled. This model is based on the JavaBeans component event and listener model.
Question 93. What Is Javaserver Faces Expression Language?
Answer :
A simple expression language used by a JavaServer Faces UI component tag attributes to bind the associated component to a bean property or to bind the associated component's value to a method or an external data source, such as a bean property. Unlike JSP EL expressions, JavaServer Faces EL expressions are evaluated by the JavaServer Faces implementation rather than by the Web container.
Question 94. What Is Javaserver Faces Navigation Model?
Answer :
A mechanism for defining the sequence in which pages in a JavaServer Faces application are displayed.
Question 95. What Is Javaserver Faces Ui Component?
Answer :
A user interface control that outputs data to a client or allows a user to input data to a JavaServer Faces application.
Question 96. What Is Javaserver Faces Ui Component Class?
Answer :
A JavaServer Faces class that defines the behavior and properties of a JavaServer Faces UI component.
Question 97. What Is Javaserver Faces Validation Model?
Answer :
A mechanism for validating the data a user inputs to a JavaServer Faces UI component.
Question 98. What Is Java Server Pages (jsp)?
Answer :
An extensible Web technology that uses static data, JSP elements, and server-side Java objects to generate dynamic content for a client. Typically the static data is HTML or XML elements, and in many cases the client is a Web browser.
Question 99. What Is Java Server Pages Standard Tag Library (jstl)?
Answer :
A tag library that encapsulates core functionality common to many JSP applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization and locale-specific formatting tags, SQL tags, and functions.
Question 100. What Is Jaxr Client?
Answer :
A client program that uses the JAXR API to access a business registry via a JAXR provider.
Question 101. What Is Jaxr Provider?
Answer :
An implementation of the JAXR API that provides access to a specific registry provider or to a class of registry providers that are based on a common specification.
Answer :
An JDBC for database-independent connectivity between the J2EE platform and a wide range of data sources.
Question 103. What Is Jms Administered Object?
Answer :
A preconfigured JMS object (a resource manager connection factory or a destination) created by an administrator for the use of JMS clients and placed in a JNDI namespace.
Question 104. What Is Jms Application?
Answer :
One or more JMS clients that exchange messages.
Question 105. What Is Jms Client?
Answer :
A Java language program that sends or receives messages.
Question 106. What Is Jms Provider?
Answer :
A messaging system that implements the Java Message Service as well as other administrative and control functionality needed in a full-featured messaging product.
Question 107. What Is "application Client"?
Answer :
A first-tier J2EE client component that executes in its own Java virtual machine. Application clients have access to some J2EE platform APIs.
Question 108. What Is "application Client Container"?
Answer :
A container that supports application client components.
Question 109. What Is "application Client Module"?
Answer :
A software unit that consists of one or more classes and an application client deployment descriptor.
Question 110. What Is "application Component Provider"?
Answer :
A vendor that provides the Java classes that implement components' methods, JSP page definitions, and any required deployment descriptors.
Question 111. What Is "application Configuration Resource File"?
Answer :
An XML file used to configure resources for a Java Server Faces application, to define navigation rules for the application, and to register converters, Validator, listeners, renders, and components with the application.
Question 112. What Is "archiving"?
Answer :
The process of saving the state of an object and restoring it.
Question 113. What Is "asant"?
Answer :
A Java-based build tool that can be extended using Java classes. The configuration files are XML-based, calling out a target tree where various tasks get executed.
Question 114. What Is "attribute"?
Answer :
A qualifier on an XML tag that provides additional information.
Question 115. What Is Authentication?
Answer :
The process that verifies the identity of a user, device, or other entity in a computer system, usually as a prerequisite to allowing access to resources in a system. The Java servlet specification requires three types of authentication-basic, form-based, and mutual-and supports digest authentication.
Question 116. What Is Authorization?
Answer :
The process by which access to a method or resource is determined. Authorization depends on the determination of whether the principal associated with a request through authentication is in a given security role. A security role is a logical grouping of users defined by the person who assembles the application. A deployer maps security roles to security identities. Security identities may be principals or groups in the operational environment.
Question 117. What Is Authorization Constraint?
Answer :
An authorization rule that determines who is permitted to access a Web resource collection.
Question 118. What Is Backing Bean?
Answer :
A JavaBeans component that corresponds to a JSP page that includes JavaServer Faces components. The backing bean defines properties for the components on the page and methods that perform processing for the component. This processing includes event handling, validation, and processing associated with navigation.
Question 119. What Is Basic Authentication?
Answer :
An authentication mechanism in which a Web server authenticates an entity via a user name and password obtained using the Web application's built-in authentication mechanism.
Question 120. What Is Bean-managed Persistence?
Answer :
The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean.
Question 121. What Is Bean-managed Transaction?
Answer :
A transaction whose boundaries are defined by an enterprise bean.
Question 122. What Is Binding (xml)?
Answer :
Generating the code needed to process a well-defined portion of XML data.
Answer :
J2EE is an environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitier, web-based applications.
Question 124. What Is The J2ee Module?
Answer :
A J2EE module consists of one or more J2EE components for the same container type and one component deployment descriptor of that type.
Question 125. What Are The Components Of J2ee Application?
Answer :
A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:
Question 126. What Are The Four Types Of J2ee Modules?
Answer :
1. Application client module
2. Web module
3. Enterprise JavaBeans module
4. Resource adapter module
Question 127. What Does Application Client Module Contain?
Answer :
The application client module contains:
Application client modules are packaged as JAR files with a .jar extension.
Question 128. What Does Web Module Contain?
Answer :
The web module contains:
Web modules are packaged as JAR files with a .war (Web ARchive) extension.
Question 129. What Is "applet"?
Answer :
A J2EE component that typically executes in a Web browser but can execute in a variety of other applications or devices that support the applet programming model.
Question 130. What Is "applet Container"?
Answer :
A container that includes support for the applet programming model.
Question 131. What Is "application Assembler"?
Answer :
A person who combines J2EE components and modules into deployable application units.
Question 132. Write A Code To Sort A List Of Strings Using Java 8 Lambda Expression?
Answer :
. private void sortUsingJava8(List names){
Collections.sort(names, (p1, p2) -> p1.compareTo(p2));
}
Question 133. What Is Meant By Binding In Rmi?
Answer :
Binding is the process of associating or registering a name for a remote object, which can be used as a further, in order to look up that remote object. A remote object can be associated with a name using the bind / rebind methods of the Naming class.
Question 134. What Is The Front Controller Class Of Spring Mvc?
Answer :
The Dispatcher Servlet class works as the front controller in Spring MVC.
Question 135. What Are The States Of An Object In Hibernate?
Answer :
The states of an object in hibernate are
Transient: The object is in the transient state if it is just created but has no primary key (identifier) and it is not associated with the session.
Persistent: The object is in the persistent state if the session is open, and we just saved the instance in the database or retrieved the instance from the database.
Detached: The object is in the detached state if the session is closed. After detached state, the object comes to persistent state if we call lock() or update() method.
Question 136. How To Make An Immutable Class In Hibernate?
Answer :
If we mark a class as mutable=”false”, the class will be treated as an immutable class. The default value of mutable is “true”.
Question 137. What Is Hash-collision In Hashtable? How Was It Handled In Java?
Answer :
In Hashtable , if two different keys have the same hash value then it leads to hash -collision. A bucket of type linked list used to hold the different keys of same hash value.
Question 138. Write A Syntax To Convert A Given Collection To Synchronizedcollection ?
Answer :
Collections.synchronizedCollection(Collection collectionObj) will convert a given collection to synchronized collection.
Question 139. Write A Code To Make Collections Readonly?
Answer :
We can make the Collection readOnly by using the following lines code:
General : Collections.unmodifiableCollection(Collection c)Collections.unmodifiableMap(Map m)
Collections.unmodifiableList(List l)
Collections.unmodifiableSet(Set s)
Question 140. Mention The Uses Of Synchronized Block
Answer :
We are using Synchronized block because
• It helps to lock an object for every shared resource.
• The scope of synchronized block is smaller than the method.
Question 141. What Are The Functions Of Hashcode() Method?
Answer :
Question 142. What Is The Default Size Of Load Factor In Hashing Based Collection?
Answer :
Default Size = 0.75. The default capacity is computed as initial capacity * load factor.
Question 143. What Are The Differences Between The Jsp Custom Tags & Java Beans?
Answer :
• Custom tags can manipulate JSP content, but beans cannot.
• Composite operations can be reduced to a considerably simpler form with custom tags than with beans.
• Custom tags require reasonably a bit more work to set up than do beans.
• Custom tags are available only in JSP 1.1 and so on, but beans can be used in all JSP 1.x versions
Question 144. Explain Expression Language In Jsp?
Answer :
The expression language is used in JSP to simplify the accessibility of objects and It provides many objects that can be used directly like param, requestScope, sessionScope, applicationScope, request, session etc.
Question 145. Define The Implicit Object?
Answer :
JSP implicit objects are those Java objects that the JSP Container makes available to developers in every page. A developer can able to call them directly, without being explicitly declared. JSP Implicit Objects are also known as pre-defined variables. The following objects are considered implicit in a JSP page:
• application
• page
• request
• response
• session
• exception
• out
• config
• pageContext
Question 146. Define A Cookie And What Are The Difference Between Session And Cookie?
Answer :
A cookie is a small piece of information, this piece of information sends to the browser by a web server. The browser stores the cookies for every Web server in a local file. In a future request or future reference, the browser sends all stored cookies for that detailed Web server.
The difference between cookies and sessions are:
• The session is working, regardless of the settings on the client browser. The client may have selected to disable cookies.
• The session and cookies also differ in storing the amount of information. The HTTP session is able to store any Java object, while a cookie can only store String objects.
Question 147. What Is Http Tunneling?
Answer :
HTTP Tunneling is a technique by which, communications performed using various network protocols are encapsulated using the HTTPS protocols. The HTTP protocol, therefore, acts as a wrapper for a channel that the network protocol being tunneled use to communicating. The masking of other protocol requests as HTTP requests is HTTP Tunneling.
Question 148. What Is A Function Of Ioc Container In Spring?
Answer :
IOC container is responsible to:
• create the instance
• configure the instance, and
• assemble the dependencies
Question 149. What Is Lazy Loading In Hibernate?
Answer :
Lazy loading in hibernate improves the performance. It loads the child objects on demand.
while Hibernate 3, lazy loading is enabled by default, we don’t need to do lazy=”true”. It means not to load the child objects when a parent is loaded.
Question 150. How Can We Fetch Records By Spring Jdbctemplate?
Answer :
We can fetch records from the database by the query method of JdbcTemplate. There are two interfaces to do this:
1. ResultSetExtractor
2. RowMapper
Question 151. Are Constructors Inherited? Can A Subclass Call The Parent’s Class Constructor?
Answer :
We cannot inherit a constructor. We create an instance of a subclass using a constructor of one of its superclass. Because override the superclass constructor is not our wish so that, we override a superclass constructor, then we destroy the encapsulation abilities of the language.
Answer :
Expansion of JSON is “JavaScript Object Notation”, It is a much lighter and readable alternative to XML. It is an independent and easily parse-able in all programming languages. It is primarily used for Communicating between client – server or server -server communication. It is a much lighter and readable alternative to XML.
Question 153. What Are The Advantages Of Json Over Xml?
Answer :
The advantages of JSON over XML are
1. JSON is Lighter and faster than XML.
2. Better understandable.
3. Easy to parse and conversion to objects for information consumption.
4. Support multiple data types – JSON support string, number, array, Boolean but XML data are all strings.
Question 154. Name The Methods Of Object Class?
Answer :
clone() – This method helps to create and return a copy of the object.
equals() – This method helps to compare.
finalize() – Called by the garbage collector on an object.
getClass() – It helps to return the runtime class of an object.
hashCode() – Helps to return a hash code value for the object.
toString() – helps to return a string representation of the object.
notify(), notifyAll(), and wait() – It helps to synchronize the activities of independently running threads in a program.
Question 155. Define Content Negotiation?
Answer :
If we have visited website to searching the information, we will get the information in different languages and in different formats when a client makes an HTTP request to a server, the client can also specify the media types here. The client can specify what it can accept back from the host and on the basis of availability the host will return to the client. This is known as content negotiation because client and server negotiated on the language and format of the content to be shared.
Answer :
Yes, we can import the same package/class multiple times. Compiler and JVM are not complaining about it. And the JVM will internally load the class only once no matter how many times we import the same class.
Question 157. Define Abstract Class?
Answer :
A class which contains the abstract keyword in its declaration is known as abstract class. It can have abstract and non-abstract methods (method with body).
1. This class can have public, private, protected or constants and default variables.
2. It needs to be extended and its method implemented. It cannot be instantiated.
3. If a class has at least one abstract method, then the class must be declared abstract.
Question 158. Describe The Annotations?
Answer :
It is a form of metadata and it provides data about a program that is not part of the program itself. An annotation has no direct effect on the operation of the code they annotate.
Uses of Annotations :
• Information for the compiler — It can be used by the compiler to detect errors or suppress warnings.
• Compile-time and deployment-time processing — some software tools can process annotation information to generate code, XML files, and so forth.
• Runtime processing — few annotations are available to be examined at runtime.
Question 159. Java Doesn't Use Pointers. Why?
Answer :
Pointers are susceptible and slight carelessness in their use may result in memory problems and hence Java basically manages their use.
Question 160. Distinguish Between Static Loading And Dynamic Class Loading?
Answer :
Static loading – Classes are loaded statically with operator “new”.
Dynamic class loading – It is a technique for programmatically invoking the functions of a class loader at run time.
The syntax isClass.forName (Test className);
Question 161. Explain Struts 1 Classes Are Not Thread Safe Whereas Struts 2 Classes Are Thread Safe?
Answer :
Struts 1 actions are a singleton. So all threads operate on the single action object and hence make it thread-unsafe.Struts 2 actions are not a singleton and a new action object copy are created each time a new action request is made and hence it threads safe.
Question 162. Define Jaxp & Jaxb?
Answer :
JAXP: – Stands for Java API for XML Processing. This provides a common interface for creating and using DOM, SAX, and XSLT APIs in Java regardless of which vendor’s implementation is actually being used.
JAXB: – It Stands for Java API for XML Binding. This standard defines a system for a script out Java objects as XML and for creating Java objects from XML structures.
Question 163. Define An Enumeration?
Answer :
Usually, we called enumeration as an enum. An enumeration is an interface containing methods for accessing the original data structure from which the enumeration is obtained. It allows sequential access to all the elements stored in the collection.
Question 164. How Can We Find The Actual Size Of An Object On The Heap?
Answer :
In Java, there is no way to find out the actual size of an object on the heap.
Question 165. Which Api Is Provided By Java For Operations On A Set Of Objects?
Answer :
Java provides a Collection API which provides many useful methods which can be applied to a set of objects. Some of the important classes provided by Collection API include ArrayList, HashMap, TreeSet, and TreeMap.
Question 166. What’s The Base Class Of All Exception Classes?
Answer :
Java.Lang.throwable – It is the super class of all exception classes and all exception classes are derived from this base class.
Question 167. Why We Used Vector Class?
Answer :
The Vector class provides the ability to execute a growable array of objects. Vector proves to be very useful if you don’t know the size of the array in advance, or we need one that can change sizes over the lifetime of a program.
Question 168. What Is The Difference Between Transient And Volatile Variable In Java?
Answer :
Transient: In Java, it is used to specify the variable is not being serialized. Serialization is a process of saving an object’s state in Java. When we want to persist and the object’s state by default, all instance variables in the object are stored. In some cases, if we want to avoid persisting few variables because we don’t have the necessity to transfer across the network. So, declare those variables as transient. If the variable is confirmed as transient, then it will not be persisted.
Transient keyword is used with that instance variable which will not participate in the serialization process. We cannot use static with a transient variable as they are part of the instance variable.
Volatile: Volatile keyword is used with only variable in Java and it guarantees that the value of the volatile variable will always be read from main memory and not from Thread’s local cache, it can be static.
Answer :
The map interface is not compatible with the Collection interface. Because Map requires key as well as value, for example: if we want to add key-value pair so we will use put(Object key , Object value). There are two parameters required to add an element to HashMap object. In Collection interface add(Object o) has only one parameter.
The other reasons are Map supports valueSet, keySet as well as other suitable methods which have just different views from the Collection interface.
Question 170. How Can We Restrict Inheritance For A Class?
Answer :
We can restrict inheritance for class by following steps.
1. By using final keyword
2. If we make all method final, then we cannot override that.
3. By using private constructors
4. By using Javadoc comment (//)
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.