1.
Given: 1. class Test { 2. public static void main(String args[]) { 3. int num1 = 10, num2 = 20, result; 4. result = calc(num1, num2); 5. System.out.println(result); 6. } 7. 8. // insert code here 9. } Which, inserted at line 8, produces the output 30?
2.
Given: 1. public abstract class Wow { 2. private int wow; 3. public Wow(int wow) { 4. this.wow = wow; 5. } 6. public void wow() { } 7. private void wowza() { } 8. } Which is true about the class Wow?
3.
Given: 1. class X { 2. private Y y; 3. public X(Y y) { this.y = y; } 4. } 5. class Y { 6. private X x; 7. public Y() { } 8. public Y(X x) { this.x = x; } 9. } The instance variable y is intended to represent the composition relationship "X is composed of Y." Which code correctly maintains this meaning?
4.
Which type of J2EE component is used to store business data persistently?
5.
What is the purpose of JNDI?
6.
Given: 4. class Example { 5. int x = 50; 6. int y = 100; 7. public static void main(String args[]) { 8. int x = 0, y = 10; 9. Example ex = new Example(); 10. while (x < 3) { 11. x++; y--; 12. } 13. System.out.println("x = " + x + " , y = " + y); 14. } 15. } What is the result?
7.
You have developed a MIDlet that runs on a Java-enabled Personal Digital Assistant (PDA) device. Now, your employer has asked you to port the MIDlet to run on other Java platforms. Which is true?
8.
Which statement is true?
9.
Given: 12. String s = "abcdefgabc"; 13. char c = s.charAt(2); 14. 15. if (c == 'c') 16. s = s.replace('c', 'X'); 17. else if (c == 'b') 18. s = s.replace('b', 'O'); 19. else 20. s = s.replace('c', 'O'); 21. System.out.println(s); What is the result?
10.
Which package contains classes used to create data collections, such as maps or queues?