J2ee Concepts

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Jsosa
J
Jsosa
Community Contributor
Quizzes Created: 1 | Total Attempts: 3,877
Questions: 20 | Attempts: 3,877

SettingsSettingsSettings
J2ee Concepts - Quiz

This quiz was created by TeoGol29.
Remember, concepts are what really matter.


Questions and Answers
  • 1. 

    Which of the following statements about the fetch modes in Entity beans is FALSE?

    • A.

      There are two fetch modes : EAGER and LAZY.

    • B.

      The default fetching mode for a field in an Entity bean annotated by @OneToMany is LAZY.

    • C.

      The default fetching mode for a field in an Entity bean annotated by @Basic is LAZY.

    • D.

      @Lob annotation does not have a default fetch mode.

    Correct Answer
    C. The default fetching mode for a field in an Entity bean annotated by @Basic is LAZY.
    Explanation
    The default fetching mode for a field in an Entity bean annotated by @Basic is not LAZY.

    Rate this question:

  • 2. 

    What is TRUE about the cascading and cascade mode attributes in Entity Beans?

    • A.

      Cascade mode attributes can be specified for the association annotaions (like @OneToMany) in an entity bean.

    • B.

      The cascading direction is from the target entity to the source entity.

    • C.

      PERSIST, DELETE and REFRESH are cascading mode attributes.

    • D.

      Refresh cascade causes to refresh the target entities of a relationship when refresh is invoked on the source entity of the relationship

    Correct Answer(s)
    A. Cascade mode attributes can be specified for the association annotaions (like @OneToMany) in an entity bean.
    D. Refresh cascade causes to refresh the target entities of a relationship when refresh is invoked on the source entity of the relationship
    Explanation
    Cascade mode attributes can be used to specify the cascading behavior for association annotations in an entity bean, such as @OneToMany. This means that when certain operations are performed on the source entity, such as persisting, deleting, or refreshing, the same operations will be cascaded to the target entities of the relationship. In this case, the refresh cascade mode attribute specifically causes the target entities to be refreshed when the refresh operation is invoked on the source entity of the relationship.

    Rate this question:

  • 3. 

    How to declare JPA Entity class?

    • A.

      Write a private final Entity class named after the mapped table

    • B.

      Annotate the class with @Entity

    • C.

      Annotate the primary key attribute or its getter method with @Id

    • D.

      Define private attributes to map the table columns.

    • E.

      Write the finalize method

    Correct Answer(s)
    B. Annotate the class with @Entity
    C. Annotate the primary key attribute or its getter method with @Id
    D. Define private attributes to map the table columns.
    Explanation
    The correct answer is to annotate the class with @Entity, annotate the primary key attribute or its getter method with @Id, and define private attributes to map the table columns. This is the standard way to declare a JPA Entity class. The @Entity annotation marks the class as an entity that will be mapped to a database table. The @Id annotation is used to indicate the primary key attribute of the entity. Private attributes are used to map the columns of the table.

    Rate this question:

  • 4. 

    What is the impact of marking an attribute in a JPA Entity class with @Transient annotation?

    • A.

      This attribute will should not be serialized by the EJB container

    • B.

      This attribute will should not be persisted by the EJB container.

    • C.

      This attribute will should not be garbage collected by the EJB container

    Correct Answer
    B. This attribute will should not be persisted by the EJB container.
    Explanation
    By marking an attribute in a JPA Entity class with the @Transient annotation, it indicates that the attribute should not be persisted by the EJB container. This means that the attribute will not be stored in the database when the entity is saved or updated. This can be useful when there are certain attributes that are not relevant to be stored in the database or when they are derived from other attributes and can be calculated on the fly.

    Rate this question:

  • 5. 

    In which life cycle state the JPA entity class is synchronized with the database?

    • A.

      New

    • B.

      Managed

    • C.

      Synchronized

    • D.

      Detached

    • E.

      Removed

    Correct Answer
    B. Managed
    Explanation
    The JPA entity class is synchronized with the database in the "Managed" life cycle state. In this state, the entity is being managed by the persistence context, and any changes made to the entity will be automatically synchronized with the database when the transaction is committed.

    Rate this question:

  • 6. 

    What causes the entity manager to move an Entity instance from the detached to the managed state?

    • A.

      Invoke the persist() method of the entity manager on the instance

    • B.

      Invoke the merge() method of the entity manager on the instance

    • C.

      Invoke the manage() method of the entity manager on the instance

    • D.

      Invoke the remove() method of the entity manager on the instance

    Correct Answer
    B. Invoke the merge() method of the entity manager on the instance
    Explanation
    When the merge() method of the entity manager is invoked on an Entity instance, it causes the entity manager to move the instance from the detached state to the managed state. This means that the entity instance becomes associated with the persistence context of the entity manager and any changes made to the instance will be tracked and synchronized with the database when the transaction is committed. The merge() method is typically used when you want to update an existing entity with new data from a detached instance.

    Rate this question:

  • 7. 

    Which of the following is NOT a JPA entity manager method?

    • A.

      Persist

    • B.

      Flush

    • C.

      Contains

    • D.

      Detach

    • E.

      Find

    Correct Answer
    D. Detach
    Explanation
    The "Detach" method is not a JPA entity manager method. JPA entity manager provides methods like "Persist" to persist an entity, "Flush" to synchronize the changes to the database, "Contains" to check if an entity is managed, and "Find" to retrieve an entity by its primary key. However, "Detach" is not a valid JPA entity manager method.

    Rate this question:

  • 8. 

    Which method of the jpa entity manager would you use to force synchronizing the persistence context from the database?

    • A.

      Synchronize

    • B.

      Flush

    • C.

      Refresh

    • D.

      Persist

    Correct Answer
    C. Refresh
    Explanation
    The refresh method of the JPA entity manager is used to force synchronizing the persistence context from the database. This method retrieves the latest state of an entity from the database and updates the corresponding entity object in the persistence context. It is useful when there is a need to reload the entity with the most up-to-date data from the database, discarding any changes made to the entity in the persistence context.

    Rate this question:

  • 9. 

    Which method of the jpa entity manager would you use to force synchronizing the database with the entities of the persistence context?

    • A.

      Synchronize

    • B.

      Flush

    • C.

      Refresh

    • D.

      Persist

    Correct Answer
    B. Flush
    Explanation
    The flush method of the JPA entity manager is used to force synchronizing the database with the entities of the persistence context. It ensures that all pending changes to the entities are written to the database immediately. This is useful when you want to make sure that any changes made to the entities are persisted in the database before performing any further operations.

    Rate this question:

  • 10. 

    In the web services world, the REST (REpresentational State Transfer) is:

    • A.

      A protocol.

    • B.

      A software architectural paradigm

    • C.

      A standard API.

    Correct Answer
    B. A software architectural paradigm
    Explanation
    The REST (REpresentational State Transfer) is a software architectural paradigm. It is a design approach for building scalable and loosely coupled web services. RESTful systems use HTTP as the main communication protocol and follow a set of principles and constraints to enable interoperability and simplicity. This architectural style emphasizes stateless communication, resource-oriented design, and the use of standard HTTP methods (GET, POST, PUT, DELETE) for manipulating resources. It is widely used in modern web development for creating APIs that can be easily consumed by different clients.

    Rate this question:

  • 11. 

    In a RESTful web service, you would use the HTTP methods as verbs to invoke the CRUD action (create, read, update, and delete) Which of the following is true:

    • A.

      To read use HTTP get method.

    • B.

      To delete use HTTP delete method.

    • C.

      To create use HTTP post method.

    • D.

      To update use HTTP put method

    Correct Answer(s)
    A. To read use HTTP get method.
    B. To delete use HTTP delete method.
    Explanation
    In a RESTful web service, the HTTP methods are used as verbs to invoke the CRUD actions. The correct answer states that to read data, the HTTP GET method should be used, and to delete data, the HTTP DELETE method should be used. This aligns with the standard conventions of RESTful architecture, where GET is used for retrieving data and DELETE is used for removing data.

    Rate this question:

  • 12. 

    When is it most appropriate to architect your enterprise java application using SOAP protocol web services over RESTful?

    • A.

      When client-server communication bandwidth is limited.

    • B.

      When the web service interface must be predefined in a concrete contract.

    • C.

      When a web based application utilizes AJAX components which consume the web service.

    • D.

      When asynchronous invocation is required.

    Correct Answer(s)
    B. When the web service interface must be predefined in a concrete contract.
    D. When asynchronous invocation is required.
    Explanation
    SOAP protocol web services are most appropriate when the web service interface must be predefined in a concrete contract and when asynchronous invocation is required. SOAP allows for the definition of a strict interface between the client and server, ensuring that both parties understand the structure and format of the data being exchanged. This is useful when the application requires a predefined and standardized interface. Additionally, SOAP supports asynchronous invocation, allowing the client to send a request and continue with other tasks without waiting for a response. This is beneficial when the application needs to perform multiple tasks simultaneously or when there is a need for non-blocking communication.

    Rate this question:

  • 13. 

    Web Services are the amalgamation of:

    • A.

      XML and SOAP

    • B.

      SOAP, UDDI, WSDL

    • C.

      WSDL and UDDI

    • D.

      Eb-XML and WSDL

    Correct Answer
    B. SOAP, UDDI, WSDL
    Explanation
    Web services are a combination of SOAP, UDDI, and WSDL. SOAP (Simple Object Access Protocol) is a messaging protocol used for exchanging structured information in web services. UDDI (Universal Description, Discovery, and Integration) is a directory service that allows businesses to publish and discover web services. WSDL (Web Services Description Language) is an XML-based language used to describe the interface and functionality of a web service. Together, these three technologies form the foundation of web services, enabling communication, discovery, and description of services over the internet.

    Rate this question:

  • 14. 

    Service Transport, XML MEssaging, Service Description and Service Discovery are four layers of:

    • A.

      Web service implementing client components.

    • B.

      Web service protocol stack

    • C.

      Web service supporting repository

    • D.

      Web service supporting request and respone components

    Correct Answer
    B. Web service protocol stack
    Explanation
    The four layers mentioned - Service Transport, XML Messaging, Service Description, and Service Discovery - are part of the Web service protocol stack. These layers work together to enable communication and interaction between different components of a Web service. The Service Transport layer handles the transportation of messages, the XML Messaging layer deals with the formatting and encoding of messages in XML, the Service Description layer provides information about the Web service, and the Service Discovery layer helps in discovering and locating available Web services. Together, these layers form the protocol stack that facilitates the functioning of Web services.

    Rate this question:

  • 15. 

    Which of the following is used to describe web services?

    • A.

      SOAP

    • B.

      Web Page

    • C.

      UDDI

    • D.

      WSDL

    Correct Answer
    D. WSDL
    Explanation
    WSDL (Web Services Description Language) is used to describe web services. It is an XML-based language that provides a standardized way to describe the functionalities and operations of a web service. WSDL defines the endpoints, input/output parameters, message formats, and communication protocols for a web service, allowing clients to understand how to interact with the service.

    Rate this question:

  • 16. 

    Web Services enables...

    • A.

      Data can be exchanged between various applications and different platforms

    • B.

      To resolve interoperability issues

    • C.

      Applications to function between two different operating systems server

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    Web services enable data to be exchanged between various applications and different platforms, allowing for interoperability between systems. This means that applications can function between two different operating systems servers. Therefore, the correct answer is "All of the above".

    Rate this question:

  • 17. 

    In accessing a web service through synchronous call,

    • A.

      Application can make a call to the web service and then continue to perform the needed task

    • B.

      A service notifies the application when it is ready

    • C.

      Application has to wait until execution is completed.

    • D.

      None of the above.

    Correct Answer
    C. Application has to wait until execution is completed.
    Explanation
    In accessing a web service through synchronous call, the application has to wait until execution is completed. This means that the application will make a call to the web service and then pause its execution until it receives a response from the service. Once the execution is completed, the application can continue to perform the needed task using the received response. This ensures that the application does not proceed with its task until it has obtained the necessary data from the web service.

    Rate this question:

  • 18. 

    Difference between RESTfull web services and SOAP web services

    • A.

      REST is more simple and easy to use than SOAP web services

    • B.

      REST uses HTTP protocol for producing or consuming web services while SOAP uses XML

    • C.

      REST is lighweight as compared to SOAP

    • D.

      All of the above.

    Correct Answer
    D. All of the above.
    Explanation
    The correct answer is "All of the above." This is because all three statements are true and highlight the key differences between RESTful web services and SOAP web services. REST is indeed simpler and easier to use compared to SOAP. REST utilizes the HTTP protocol for producing or consuming web services, while SOAP relies on XML. Additionally, REST is considered lightweight in comparison to SOAP.

    Rate this question:

  • 19. 

    What is difference between top-down and bottom-up approach of developing web services?

    • A.

      In top-down approach first WSDL document is created and then JAVA classes

    • B.

      B.In bottom-up approach first Java Code is created and then WSDL fields are generated.

    • C.

      Both a and b.

    • D.

      None of the above

    Correct Answer
    C. Both a and b.
    Explanation
    The correct answer is both a and b. In the top-down approach, the first step is to create the WSDL (Web Services Description Language) document, which defines the structure and functionality of the web service. After that, Java classes are generated based on the WSDL document. On the other hand, in the bottom-up approach, Java code is written first to implement the desired functionality of the web service. Then, WSDL fields are automatically generated based on the implemented code. Both approaches have their advantages and disadvantages, and the choice between them depends on the specific requirements and constraints of the project.

    Rate this question:

  • 20. 

    EclipseLink, TopLink, and Hybernarte are implementations of:

    • A.

      JPQL

    • B.

      REST

    • C.

      JPA

    • D.

      XML-RPC

    Correct Answer
    C. JPA
    Explanation
    EclipseLink, TopLink, and Hibernate are all implementations of JPA (Java Persistence API). JPA is a specification that defines a standard way to map Java objects to relational databases, allowing developers to interact with databases using object-oriented approaches rather than writing SQL queries. These implementations provide the necessary tools and libraries to work with JPA and handle the persistence of Java objects in a database.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 26, 2015
    Quiz Created by
    Jsosa
Back to Top Back to top
Advertisement