GSSP-Java practice questions, page 5 of 11, with answer review and explanations.
Question 21
Which of the following statements is true about the Java synchronized keyword?
It prevents multiple threads from accessing a block of code at the same time.
It allows the class to be loaded as soon as the JRE starts.
It prevents multiple developers from code redundancy.
It allows two different functions to execute in a shared manner.
Question 22
Mark works as a Programmer for InfoTech Inc. He develops a Web application that takes input from users. Which of the following methods can be used by the client and server to validate the users input? Each correct answer represents a complete solution. Choose all that apply.
Validation through Servlets on the server side
Validation using JavaScript on the client side
Validation through Java Applets on the client side
Validation through XML on the server side
Question 23
Which of the following are marker interfaces? Each correct answer represents a complete solution. Choose all that apply.
The Clonable interface
The Serializable interface
The Comparable interface
The Runnable interface
Question 24
Which of the following rules must be followed while determining a class loader? Each correct answer represents a complete solution. Choose all that apply.
A new instance of the AppletClassLoader is used while loading the first class of an applet.
If the request to load a class is triggered by a reference to it from an existing class, the class loader for the existing class is asked to load the class.
A new instance of the URLClassLoader is used while loading the first class of an application.
The primordial class loader is used if java.lang.Class.ForName is directly called.
Question 25
Mark works as a Programmer for InfoTech Inc. He wants to develop a JMS API application that is used as a messaging service application. He writes the following createSession() method. session = connection.createSession(false, 2); Which of the following statements are true about the syntax? Each correct answer represents a complete solution. Choose all that apply.
The client acknowledges a consumed message by calling the message's acknowledge method.
The acknowledge method can reduce session overhead by minimizing the work the session does to prevent duplicates.
This method instructs the session to lazily acknowledge the delivery of messages.
The session automatically acknowledges a client's receipt of a message.
If a message consumer consumes eight messages and then acknowledges the fourth message delivered, all eight messages are acknowledged.