Computer Knowledge

Java Enterprise and Web Technologies

2,183 Questions

Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.

HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts

Java Enterprise and Web Technologies Questions

Multiple choice technology web technology
  1. config.createSessionFactory()

  2. config.getSessionFactory()

  3. config.buildSessionFactory()

  4. config. SessionFactory.newInstance()

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In Hibernate 3 and earlier, the standard way to obtain a SessionFactory from a Configuration object is by calling config.buildSessionFactory(). The other methods do not exist on the configuration object.

Multiple choice technology web technology
  1. echo_sql

  2. show_sql

  3. print_sql

  4. display_sql

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The 'show_sql' property in Hibernate configuration enables logging of all executed SQL statements to the console. This is essential for debugging and understanding what SQL queries Hibernate generates. Other properties like echo_sql, print_sql, and display_sql are not standard Hibernate configuration properties.

Multiple choice technology web technology
  1. criteria.setOrder( Order.asc("name") )

  2. criteria.add( Order.asc("name") )

  3. criteria.addOrder( Order.asc("name") )

  4. criteria.addOrder( "name asc" )

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In Hibernate's Criteria API, the addOrder() method is used to apply sorting to the query results, passing an Order object such as Order.asc("name"). The methods setOrder and add are incorrect for this purpose.

Multiple choice technology web technology
  1. Pass an instance of java.util.Properties to Configuration.setProperties().

  2. Place hibernate.properties in a root directory of the classpath.

  3. Set System properties using java -Dproperty=value.

  4. All the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Hibernate accepts configuration through all three methods: passing Properties directly to Configuration object, placing hibernate.properties in classpath root, or setting System properties via -D flags. This flexibility allows different deployment and configuration strategies.

Multiple choice technology web technology
  1. sess.createQuery("SELECT * FROM CATS").list();

  2. sess.createSQLQuery("FROM CATS").list();

  3. sess.createSQLQuery("SELECT * FROM CATS").list();

  4. sess.createSQLQuery("from CATS", com.animals.Cat.class).list();

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In Hibernate, createSQLQuery is used to execute native SQL queries. The correct syntax to fetch all records from a table using a native SQL query is sess.createSQLQuery("SELECT * FROM CATS").list(). HQL syntax is used in createQuery.

Multiple choice technology programming languages
  1. Java Programming Language

  2. Java Class file format

  3. Java Application Programming Interface

  4. Java Common Type System

  5. Java Virtual Machine

  6. Java Common Language Runtime

Reveal answer Fill a bubble to check yourself
A,B,C,E Correct answer
Explanation

The Java architecture is composed of the Java Programming Language, the Java Class file format, the Java API, and the Java Virtual Machine (JVM). Common Type System and CLR belong to the .NET framework.

Multiple choice technology programming languages
  1. To improve memory management.

  2. To achieve Platform independence

  3. To improve the Application performance

  4. If Java API is not available for platform specific operation

  5. For small applications

Reveal answer Fill a bubble to check yourself
C,D Correct answer
Explanation

Java Native Interface (JNI) is used to call platform-specific native libraries when a Java API is unavailable, or to write performance-critical code in C/C++ to optimize application execution speed.

Multiple choice technology programming languages
  1. JVM's default class loader is bootstrap

  2. Java code is compiled into bytecode

  3. JVM can run code in any language, provided it has been complied to bytecode meeting JVM specification

  4. Java class file use little-endian format

  5. Garbage collector is an integral part of JVM

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Java class files use big-endian byte order (most significant byte first) for all multi-byte data, making the statement that they use little-endian format false, and thus the correct answer.

Multiple choice technology programming languages
  1. Script language declarations, scriplets and expressions.

  2. JSP standard actions

  3. JSP standard directives

  4. All the Above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The Java Server Pages (JSP) specification defines scriptlet elements (declarations, scriptlets, and expressions), standard actions (like `), and directives (like<%@ page %>`), making all options correct.

Multiple choice technology programming languages
  1. It defines the standard tag that works the same everywhere

  2. It is a single library and we can use it in multiple jsp containers

  3. It has support for the common structural tasks like iteration and condition

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

JSP Tag Libraries (JSTL - JSP Standard Tag Library) define standard tags that work consistently across different JSP containers, are portable as single libraries usable in multiple containers, and provide built-in support for common structural patterns like iteration and conditional logic.