Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

401.

Explain the difference between web services, CORBA and DCOM?

Answer»
402.

What is the difference between a SOA and a Web service?

Answer»
S.noSOAWeb Service
1.SOA or Service Oriented ARCHITECTURE is an architectural concept focused on having different services communicating with each other to carry out a more significant function.A web service is a fundamental building block present in a Service Oriented Architecture. When MULTIPLE functions GET combined, an application is created under an SOA

The above QUESTION can be a game-changing Web Service Interview Question for you. You just have to go through it one more time.

403.

What is PKI?

Answer»

Public Key Infrastructure or PKI is a framework of cybersecurity and encryption that protects COMMUNICATIONS between the SERVER and users.

It works with two different CRYPTOGRAPHIC KEYS; a public key and a private key.

404.

What do you mean by BEEP?

Answer»

BEEP or Blocks Extensible EXCHANGE Protocol is CONNECTION ORIENTED internet protocol. SOAP messages inherit the ADDITIONAL service qualities from BEEP to maintain session context at the receiver and the sender.

405.

Explain the sun-jaxws.xml file?

Answer»

The sun-jaxws.xml FILE is present in SOAP web SERVICES and HELPS in offering the endpoints details when JAX WS web services get deployed in a servlet container. Placed in WEB-INF directory, the sun-jaxws.xml file CONTAINS implementation class, endpoint name, meta information, and a URL pattern.

406.

How we can maintain session in REST Services?

Answer»
407.

What is REST Web Services and also explain its benefits?

Answer»

REpresentational State TRANSFER or REST web service is an architectural style for developing. It’s favorite due to its simplicity and fact that it builds upon existing features and SYSTEMS of HTTP in order to ACHIEVE its OBJECTIVES, as opposed to creating entirely new frameworks, technologies, and standards.

408.

What type of security is needed in web services? Explain

Answer»

Web services require the following security:

  • Username/Password approach
  • X.509 approach: It identifies the USER by a public key infrastructure
  • Kerberos
  • Digital Signature: XML signature to be USED to protect DATA
  • ENCRYPTION: XML encryption to be used to protect data
409.

What do you mean by WSDL and why it is used?

Answer»

WSDL or Web Services DESCRIPTION Language is an XML format for describing network services as a SET of endpoints OPERATING on messages containing procedure-oriented or document-oriented information. It allows developers to exchange info over a particular protocol between applications.

Continue further to access best web services INTERVIEW questions for experienced as WELL as freshers.

410.

Explain the advantages & disadvantages of SOAP Web Services?

Answer» ADVANTAGES:
  • Simple to use
  • Platform and language independent
  • Firewall friendliness
  • Use of open standards
  • Universal interoperability
  • Extremely versatile
  • Highly flexible
  • helps to create payload FORMAT and EXTENSIBLE protocol
Disadvantages:
  • Extreme reliance on HTTP
  • Statelessness
  • Considerably slow
  • Serialization by value and not by REFERENCE
411.

What do you mean by SOAP?

Answer»

Simple OBJECT Access Protocol or SOAP is a messaging protocol which allows PROGRAMS RUNNING on disparate operating systems to communicate using HTTP (Hypertext Transfer Protocol), and it's XML (Extensible Markup Language).

412.

List the types of Web Services.

Answer»

There are two types of WEB SERVICES:

  • SOAP web services: SOAP or Simple Object Access PROTOCOL is based on transferring XML data as SOAP messages.
  • RESTful web services: Used to BUILD web services that are maintainable, lightweight and scalable in nature.
413.

Explain the advantages of Web Services.

Answer»

Here are the advantages of WEB services:

414.

What are the difference between JAX RPC and JAX WS?

Answer»
S.noJAX RPCJAX WS
1.SERVICES based on JAX RPC uses the RPC programming model to invoke operations of a web service. RPC programming model invokes stubs located on the client to CALL methods on a remote server.Services based on JAX WS uses annotations to declare the endpoints of web service. The annotations use the requirement of DEPLOYMENT descriptors

This web services interview questions has always been the choice of interviewers. We suggest you go through it multiple TIMES.

415.

What are the difference between SOAP and REST Web Services?

Answer»
S.noSOAPREST
1.It stands for Simple Object Access ProtocolIt stands for Representational State
2.It was a protocol and designed with a specification.It’s an ARCHITECTURAL STYLE in which web services can be treated as a RESTful service.
3.Can’t make use of RESTCan make use of SOAP
4.It uses service INTERFACES to expose its functionality to applicationsIt uses UNIFORM Service locators to access to the components on the hardware DEVICE
416.

What is the difference between JDBC and Hibernate?

Answer»
S.noJDBCHibernate
1.Standard APIORM (Object-Relational Mapping)
2.Java applications USED JDBC for COMMUNICATING with the databaseUsed for mapping Java objects to a corresponding relational database.

To read more Hibernate Interview Questions, and MAKE the concepts clear, you can VISIT the Best Interview Question.

417.

What is Hibernate mapping file?

Answer»

The OBJECT or relational mappings are the files which are DEFINED in an XML document which instruct HIBERNATE in mapping the defined CLASSES or class to the tables in the DATABASE.

418.

What is a configuration in hibernate?

Answer»

CONFIGURATION SETTINGS are required for the database and various other related parameters in HIBERNATE. The format for displaying such information is supplied as an XML file named hibernate.cffg.xml and hibernate.PROPERTIES know as standard Java properties file.

419.

What is the default annotation for a property in hibernate?

Answer»

The DEFAULT annotation for a property in the Java FRAMEWORK is a @ld annotation, where Hibernate ASSUMES that the annotation is on the object’s access properties and detects that it is on the field. Placing the annotation @ld on getId() method GIVES access to the features through getter and SETTER methods and that too by default.

420.

How to Implement Database Relationship in Hibernate?

Answer»
421.

Why do we need transactions in hibernate?

Answer»

Transactions are required for protecting and maintaining the DATA and their consistency in HIBERNATE. JAVA application PROGRAM framework, can modify several things in the databases, but transactions are needed for retaining the DATABASE and for this, there is an availability of Transaction Interface.

422.

What are the main differences between persistent and transient objects?

Answer»
S.noPERSISTENT OBJECTSTransient Objects
1.In this state, the database has the SAVED objectsThe objects are not kept in the database in this state of Hibernation
2.Example- An entity from a REPOSITORY comes under persistent objectsUntil persisted, the CREATION of a new entity is called transients
423.

What are the states of the object in hibernate?

Answer» HIBERNATE OBJECT STATES are as follows-
  • Detached Object STATE
  • Persistent Object State
  • Transient Object State
424.

Why is Hibernate called ORM?

Answer»

Hibernate offers retrieval facilities and data query services along with GENERATING SQL calls and relaxing the developer from HANDLING the PROJECT manually and conversion of the object of the set of the RESULT. These are the reasons which make Hibernate an object-relational model for the mapping tool for Java language.

425.

List some of the database support by hibernate?

Answer»

Hibernate use SQL DATABASES for REGULARLY testing by regularly handling in the Hibernate product LIFECYCLE or Hibernate developers:

  • ORACLE 11g, 11g RAC
  • MySQL 5.1, 5.5.
  • PostgreSQL 8.4, 9.1
  • DB2 9.7 or above.
  • Microsoft SQL SERVER 2008.
  • Sybase ASE 15.5 (jConnect 6.0)
426.

Explain the difference between criteria and criterion in hibernate?

Answer»

14. What is the difference between SessionFactory and SESSION in hibernate?

S.noSessionFactory objectsSession
1.There is one SessionFactory object PER applicationThere is one Session object per client
2.Used for creation and management and it is THREADED safeSessions Session is not threaded safe and give CRUD INTERFACE to the mapped CLASSES
427.

What are the steps of calling a stored procedure in hibernate?

Answer»

Write the FOLLOWING queries-

1. Use CreateNativeSQL Method for calling a PROCEDURE

  • Query query = session.createSQLQuery (“CALL GetAllFoos ()”).addEntity;
  • LIST allFoos= query.list();

2. Use @NamedNativeQueries to call a STORED procedure

3. Use @NamedStoreProcedureQuery to call a stored procedure

Example

Use @NamedNativeQueries to call a stored procedure

@NamedNativeQueries({

          @NamedNativeQuery(

   name = "callGetAllFoos",

   query = "CALL GetAllFoos()",

      resultClass = Foo.class)

                         })

@Entity

public class Foo implements Serializable {

         // Model definition

}

Use @NamedStoreProcedureQuery to call a stored procedure

@NamedStoredProcedureQuery(

     name="GetAllFoos",

     procedureName="GetAllFoos",

     resultClasses = { Foo.class }

  )

@Entity

public class Foo implements Serializable {

 // Model Definition

}

428.

What is the difference between hibernate save () saveOrUpdate () and persist () methods?

Answer»
S.noHibernate Save()SaveorUpdate method()
1.Work to generate a new identifier and then inserting the record into the databaseIt either can UPDATE or INSERT because as per the existence of record.save() method can be FAILED with the PERSISTENCE of the PRIMARY key
2.Used for bringing a transient object to a persisting stateIt can bring both new and existing, i.e., transient and detached into a persistent state or can be said that this method can be used for re-attaching a detached object into Session
429.

Why is SessionFactory used in hibernate?

Answer»

Session Factory is used to configure objects which is further responsible for allowing instantiation of the Session object and TURNING the configuration HIBERNATION for SUPPLIED configuration file application. THREADS of an application use SESSIONFACTORY in Hibernation.

430.

What is Hibernate session factory?

Answer»

Hibernate SessionFactory is an interface, and it is created with the HELP of Configuration object. It consists of all the database related property details and in this, either hibernate.properties, the hibernate.cfg.xml file is USED for pulling it. In the case of the increased NUMBER of multiple databases, then the REQUIREMENT of creating one SessionFactory PER database.

431.

What is the use of evicting method in hibernate?

Answer»

The EVICT method is USED for detaching the object from hibernate provides evict () method and session cache. After this process, there is no persistence in the CHANGE of the object. The detachment of the associated objects can ALSO take place with the mapping associated with the CASCADE=” evict.”

432.

What is the difference between save and merge in hibernate?

Answer»
433.

What is flush in hibernate?

Answer»

The PROCEDURE of synchronizing the persistence context state with the database is known as flushing. There are a set of methods sent by Hibernate Session and ENTITYMANAGER with the help of which the persistence state of an entity can be CHANGED by the APPLICATION developer.

434.

What is transaction commit in hibernate?

Answer»
435.

How many types of transaction are there in hibernate?

Answer»

There are four TRANSACTIONS in Hibernate ORM, and these are Atomicity, Consistency, ISOLATION, and DURABILITY. Acronym used is ACID. These are the PROPERTIES which every transaction follows.

436.

What is the Java Persistence API used for?

Answer»

Java API or known as JPA is an INTERFACE SPECIFICATION of Java application program. It is USED to describes the relational DATA’s management in the Java-based applications ALONG with Enterprise Edition and Java platform.

437.

What is the benefit of using hibernate?

Answer»
438.

What is hibernate and why it is used?

Answer»

It is an ORM DEVELOPED for mapping tool for Java APPLICATION program. It has been used in the development of Java application program as the primary function of Hibernate ORM is mapping the classes to the database TABLES and the types of Java data to SQL data types.

Other uses are-
  • Retrieving the data results
  • Writing data queries
  • Solves the problems of the mismatch of the TRADITIONAL OBJECT and relational impedance issue
439.

What do you mean by Ordered and Sorted in collections in Java?

Answer»

In an ordered collection, the elements have a specific order, which is independent of the value. For EXAMPLE a List.

In the SORTED collection, the collection has an order, and the order depends on the value of the ELEMENT. For example a SortedSet.

Developers should know everything about core java programs before their NEXT interview.

440.

What are different access specifiers in Java? Explain

Answer»

Java Access Specifiers REGULATE access to field, CLASS, and method. Also CALLED as visibility specifiers, they determine if a method or field can be used by another method in some other class. An important part of OOP, they are also used to RESTRICT access.

There are four types of Access Specifiers:

  • Public
  • Private
  • Protected
  • Default
441.

What is the difference between String, String Builder, and Buffer?

Answer»
S.noStringStringBufferStringBuilder
1.IMMUTABLEMutableMutable
2.For logic operations, it is slowThread-safeFaster and more efficient
3.Use it when immutable structure is required.Use it for creating mutable character SEQUENCE but string CHANGES must be synchronizedUse it for creating mutable character sequence
442.

What is Encapsulation in Java? Explain

Answer»

Encapsulation is one of the FOUR OOP concepts. It is a way of wrapping variables and code on data as a SINGLE unit. The class variables are HIDDEN from other classes, and can be accessed only through their current class. Therefore, this method is also called data hiding.

443.

What do you mean by composition in java?

Answer»

It is the DESIGN technique for implementing has-a relationship in a class. You can USE java INHERITANCE or Object composition for reusing the code. You can achieve Java composition by using instance VARIABLES that are referring to other objects.

444.

What do you mean by ternary operator in java?

Answer»

It is the only conditional operator that can take THREE OPERANDS and assists in EVALUATING Boolean expressions. It is a replacement for if-then-else statement and is USED a lot to replace the SWITCH. Its goal s to decide what value should the variable be assigned.

445.

Why we used break and continue statement in Java?

Answer»

When the break statement is inside a loop, the loop gets terminated and the program resumes at the next statement after the loop.

The CONTINUE statement can be USED in the loop CONTROL structure. It causes the loop to jump to the next ITERATION.

446.

Java is Pass by Value or Pass by Reference? Explain

Answer»

JAVA is pass by value because variables are references and their value is passed to the methods.

This question was asked in a LOT of latest core java interview QUESTIONS.

447.

How we can run a JAR file through command prompt in Java?

Answer»
448.

Explain Serialization and Deserialization in Java?

Answer»

The process of converting an object into BYTE sequence that can be persisted to a disk or can be sent through streams is CALLED SERIALIZATION.

The reverse process of Serialization, i.e. creating objects from a sequence of bytes is called deserialization.

449.

What do you mean by Garbage Collection used in Java?

Answer»

It is the process through which JAVA programs perform MEMORY management. When the Java programs run on JVM, objects get created in a part of the memory that is dedicated to program. When objects are no LONGER needed, the garbage collector finds and DELETES them to free up program memory.

450.

What do you mean by default constructor in Java?

Answer»

Java will automatically create default CONSTRUCTORS if there are no default constructors written by you.

The default CONSTRUCTOR will call parent default constructor and INITIALIZE member DATA variable to default VALUES.