123
What is the advantage of using try-with-resource over normal try-and-catch when creating AutoClosable resources?
a) Try-with-resource will automatically close the resources upon leaving the scope of try.
b) Multiple lines of resources separated by ";" can be placed inside of one try-with-resource.
c) There is no need to create a finally block with null check and close statement for each resource.
d) All are advantages (correct) |
1234
Match the servlet method to its operation?
__4__ doDelete
__2__ doPost
__3__ doPut
__1__ doGet
1. Read, provide data to user, for example, return a html page or a DB SELECT.
2. Create, process user provided data, for example, add row to a table.
3. Update, depending on the user data update information on the server, for example, DB UDPATE.
4. Delete, remove data from the server or DB. |
123321
What is false about XHMTL?
a) Elements must always be properly nested in XHTML.
b) <!DOCTYPE> is mandatory in XHTML.
c) Attribute minimization is forbidden in XHTML.
d) All others are false. (correct) |
|
|
123312321
There are no differences between the two blocks of code below. They will both produce the same result. (Note: Assume the code is correct, anything omitted is irrelevant to the question.)
// Code Block 1
Properties dbProps = new Properties();
dbProps.put("user", username);
dbProps.put("password", password);
Connection connection = DriverManager.getConnection(jdbcUrl, dbProps);
// Code Block 2
Connection connection = DriverManager.getConnection(jdbcUrl, username, password);
a) True (correct)
b) False |
413
When a JSP page is called, it will be compiled (by the JSP engine internally) into a Java servlet.
a) True (correct)
b) False |
123
All JPQL queries can be written in HQL as Hibernate is 100% compliant with JPA. However, not all HQL queries can be written in JPQL as Hibernate has extra features that JPA does not support.
a) True (correct)
b) False |
123
All JPQL queries can be written in HQL as Hibernate is 100% compliant with JPA. However, not all HQL queries can be written in JPQL as Hibernate has extra features that JPA does not support.
a) True (correct)
b) False |
|
|
1233
Match the method to its description? If you are not sure, look up the documentation online.
__2__ Can execute any query that does not return any ResultSet like INSERT and UPDATE. It returns the number of updated rows.
__1__ Can execute any type of query, like SELECT and INSERT. If return is true, the executed query has a ResultSet, otherwise, just a row count of updated rows or nothing.
__3__ Can execute any query which return a set of rows, like SELECT. It returns a ResultSet which contains the data and can never be null.
1. PreparedStatement::execute
2. PreparedStatement::executeUpdate
3. PreparedStatement::executeQuery |
4531
Which scope is used on managed bean which is to be created/instantiated for every client session?
a) @SessionScoped (correct)
b) @ViewScoped
c) @ApplicationScoped
d) @RequestScoped |
123312
Assume we have the code below, which annotation prevents "foo" from being null?
@Entity(name = "A")
@Table(name = "TABLE_A")
public class APojo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected int id;
@Column(name = "COL_1")
protected String foo;
//JPA likes default constructor
public APojo() {
}
}
a) @Basic
b) @Basic(optional=false) (CORRECT)
c) @Basic(optional=true)
d) No need because by default nothing can be null. |
|
|
132
In which of the following JSF phases has HTTP request parameters placed in a hash table and passed to all objects in the component tree.
a) Restore View
b) Update Model Values
c) Apply Request Values (correct)
d) Process Validations |
4314
What does the annotation @Transient on a field or property of an entity mean?
a) It specifies that the field or property is to be mapped to a column on a table in the database.
b) It specifies that the field or property is not persistent. (correct)
c) All answers are wrong.
d) It specifies that the field or property can be null. |
123213
What is true about the @Table annotation?
a) All answers are true.(correct)
b) If no @Table annotation is used, then default values are used, that is, the entity class MyEntity will be mapped to the myentity table in the database if no @Table annotation is provided.
c) It allows you to define the name, schema, and catalog of the table for your entity mapping. |
|