GSSP-Java practice questions, page 4 of 11, with answer review and explanations.
Question 16
You have written the following code snippet. 1. public class Read { 2. protected int ReadText(int x) { return 0; } 3. } 4. class Text extends Read { 5. /*insert code here*/ 6. } Which of the following methods, inserted independently at line 5, will compile? Each correct answer represents a complete solution. Choose all that apply.
private int ReadText(long x) { return 0; }
protected long ReadText(int x, int y) { return 0; }
protected long ReadText(long x) { return 0; }
protected int ReadText(long x) { return 0; }
private int ReadText(int x) { return 0; }
public int ReadText(int x) { return 0; }
protected long ReadText(int x) { return 0; }
Question 17
You work as a Software Developer for UcTech Inc. You create a session using the HttpSession interface. You want the attributes to be informed when the session is moved from one JVM to another and also when an attribute is added or removed from the session. Which of the following interfaces can you use to accomplish the task? Each correct answer represents a complete solution. Choose all that apply.
HttpSessionBindingListener
HttpSessionListener
HttpSessionActivationListener
HttpSessionAttributeListener
Question 18
Which of the following statements are true? Each correct answer represents a complete solution. Choose all that apply.
An inner class cannot be defined as private.
An inner class cannot be defined as protected.
An inner class can be defined as private.
An inner class can extend another class.
Question 19
You work as a programmer for PassGuide.Inc. You have a session object named session1 with an attribute named Attribute1, and an HttpSessionBindingEvent object binding1 bound to session1. Which of the following will be used to retrieve Attribute1? Each correct answer represents a complete solution. Choose all that apply.