| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 840 人关注过本帖
标题:129--147题
只看楼主 加入收藏
kingarden
Rank: 2
等 级:论坛游民
威 望:1
帖 子:517
专家分:40
注 册:2004-12-8
收藏
 问题点数:0 回复次数:0 
129--147题

What is the result?

A.Compilation will fail B.Compilation will succeed and the program will print “3” C.Compilation will succeed but the program will throw a ClassCastException at line 6 D.Compilation will succeed but the program will throw a ClassCastException at line 7

129. Which two create an instance of an array? (Choose Two)

A. int[] ia = new int [15]; B. float fa = new float [20]; C. char[] ca = “Some String”; D. Object oa = new float[20]; E. Int ia [][] = (4, 5, 6) (1, 2, 3)

130. Given:

1. public class ExceptionTest { 2. class TestException extends Exception {} 3. public void runTest () throws TestException {} 4. public void test () /* Point X*/ { 5. runTest (); 6. } 7. }

At point X on line 4, which code can be added to make the code compile?

A.throws Exception B.catch (Exception e) C.throws RuntimeException D.catch (TestException e) E.no code is necessary

131. Click the exhibit button:

1. public class SwitchTest { 2. public static void main (String []args) { 3. System.out.PrintIn(“value =” +switchIt(4)); 4. } 5. public static int switchIt(int x) { 6. int j = 1; 7. switch (x) { 8. case 1: j++; 9. case 2: j++; 10. case 3: j++; 11. case 4: j++; 12. case 5: j++; 13. default:j++; 14. } 15. return j + x; 16. } 17. }

What is the output from line 3?

A. Value = 3 B. Value = 4 C. Value = 5 D. Value = 6 E. Value = 7 F. Value = 8

132. Which four types of objects can be thrown using the throw statement? (Choose Four)

A.error B.event C.object D.exception E.throwable F.RuntimeException

133. Given:

1. public class ForBar { 2. public static void main(String []args) { 3. int i = 0, j = 5; 4. tp: for (;;) { 5. i ++; 6. for(;;) 7. if(i > --j) break tp; 8. } 9. system.out.printIn(“i = ” + i + “, j = “+ j); 10. } 11. }

What is the result?

A.The program runs and prints “i=1, j=0” B.The program runs and prints “i=1, j=4” C.The program runs and prints “i=3, j=4” D.The program runs and prints “i=3, j=0” E.An error at line 4 causes compilation to fail F.An error at line 7 causes compilation to fail

134. Which two can directly cause a thread to stop executing? (Choose Two)

A. Exiting from a synchronized block. B. Calling the wait method on an object. C. Calling the notify method on an object. D. Calling the notifyAll method on an object. E. Calling the setPriority method on a thread object.

135. Given:

1. public class Foo implements Runnable ( 2. public void run (Thread t) { 3. system.out.printIn(“Running.”); 4. } 5. public static void main (String[] args) { 6. new thread (new Foo()).start(); 7. ) 8. )

What is the result? A. An exception is thrown, B. The program exits without printing anything. C. An error at line 1 causes compilation to fail. D. An error at line 6 causes the compilation to fail. E. “Running” is printed and the program exits. 136. Which constructs a DataOutputStream?

A. new dataInputStream(“in.txt”); B. new dataInputStream(new file(“in.txt”)); C. new dataInputStream(new writer(“in.txt”)); D. new dataInputStream(new FileWriter(“in.txt”)); E. new dataInputStream(new InputStream(“in.txt”)); F. new dataInputStream(new FileInputStream(“in.txt”));

137. Which can be used to decode charS for output?

A. java.io.InputStream B. java.io.EncodedReader C. java.io.InputStreamReader D. java.io.InputStreamWriter E. java.io.BufferedInputStream

138. Given:

1. public class Test { 2. public static void main (String [] args) { 3. string foo = “blue”; 4. string bar = foo; 5. foo = “green”; 6. System.out.printIn(bar); 7. } 8. }

What is the result?

A.An exception is thrown. B.The code will not compile. C.The program prints “null”. D.The program prints “blue”. E.The program prints “green”.

139. Which code determines the int value foo closest to a double value bar?

A. int foo = (int) Math.max(bar); B. int foo = (int) Math.min(bar); C. int foo = (int) Math.abs(bar); D. int foo = (int) Math.ceil(bar); E. int foo = (int) Math.floor(bar); F. int foo = (int) Math.round(bar);

140. Which two demonstrate encapsulation of data? (Choose Two)

A.Member data has no access modifiers. B.Member data can be modified directly. C.The access modifier for methods is protected. D.The access modifier to member data is private. E.Methods provide for access and modification of data.

141. Click on the exhibit button:

1. class A { 2. public String toString () { 3. return “4”; 4. } 5. } 6. class B extends A { 7. 8. public String toString () { 8. return super.toString() + “3”; 9. } 10. } 11. public class Test { 12. public static void main(String[]args) { 13. System.out.printIn(new B()); 14. } 15. } What is the result?

A. Compilation succeeds and 4 is printed. B. Compilation succeeds and 43 is printed. C. An error on line 9 causes compilation to fail. D. An error on line 14 causes compilation to fail. E. Compilation succeeds but an exception is thrown at line 9

142. Which two statements are true? (Choose Two)

A.An anonymous inner class can be declared inside of a method. B.An anonymous inner class constructor can take arguments in some situation. C.An anonymous inner class that is a direct subclass that is a direct subclass of Object can implement multiple interfaces . D.Even if a class Super does not implement any interfaces, it is still possible to define an anonymous inner class that is an immediate subclass of Super that implements a single interface. E.Event if a class Super does not implement any interfaces, it is still possible to define an anonymous inner class that is an immediate subclass of Super that implements multiple interfaces.

143. Given:

1. public class MethodOver { 2. private int x, y; 3. private float z; 4. public void setVar(int a, int b, float c){ 5. x = a; 6. y = b; 7. z = c; 8. } 9. }

Which two overload the setVar method? (Choose Two)

A.void setVar (int a, int b, float c){ x = a; y = b; z = c; } B. public void setVar(int a, float c, int b) { setVar(a, b, c); } C. public void setVar(int a, float c, int b) { this(a, b, c); } D. public void setVar(int a, float b){ x = a; z = b; } E. public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }

144. Which statements about static inner classes are true? (Choose Two)

A. A static inner class requires a static initializer. B. A static inner class requires an instance of the enclosing class. C. A static inner class has no reference to an instance of the enclosing class. D. A static inner class has access to the non-static members of the outer class. E. Static members of a static inner class can be referenced using the class name of the static inner class.

145. Given:

1. public class X { 2. public object m () { 3. object o = new float (3.14F); 4. object [] oa = new object [1]; 5. oa[0]= o; 6. o = null; 7. oa[0] = null; 8.return o; 9. } 10. }

When is the float object created in line 3, eligible for garbage collection?

A. Just after line 5 B. Just after line 6 C. Just after line 7 D. Just after line 8(that is, as the method returns)

146. Which two interfaces provide the capability to store objects using a key-value pair? (Choose Two)

A. java.util.Map B. java.util.Set C. java.util.List D. java.util.StoredSet E. java.util.StoredMap F. java.util.Collection

147. Which interface does java.util.Hashable implement?

A. java.util.Map B. java.util.List C. java.util.Hashable D. java.util.Collection Answer Key: 1. C 2. D,E 3. B 4. 5 5. D 6. JavaJavaC 7. B 8. A,C 9. A,C 10. B,D 11. D,E 12. D 13. A 14. D 15. A 16. A 17. B,C 18. A,D,F 19. D 20. F 21. B 22. C 23. D 24. C 25. C 26. A 27. B 28. D 29. F 30. A 31. F 32. C 33. A 34. C,D 35. E 36. B 37. B 38. A 39. F 40. B 41. D 42. A,B,C,D,E 43. C 44. D 45. C 46. C 47. E 48. D 49. A,B 50. B 51. A 52. 13423 53. C 54. B 55. A,E 56. A,D 57. B 58. C 59. E 60. A,C 61. D,E 62. B 63. base 64. E 65. D 66. B 67. B 68. B 69. C,E 70. C 71. C 72. B,D 73. A,D 74. B 75. B 76. B 77. A 78. D,E 79. E 80. B,D,F 81. D 82. B,E 83. C,E 84. F 85. C 86. B 87. C 88. B 89. A,B,C 90. B 91. B,E 92. F 93. A 94. B 95. A 96. D,F 97. B 98. B 99. B 100. E 101. D 102. E 103. A 104. B,D 105. A 106. D 107. N/A 108. A 109. baseball 110. B 111. A,B,F 112. A 113. B 114. C,D 115. B 116. D 117. A 118. E 119. C 120. A 121. B,E 122. D 123. A 124. E 125. C,E 126. C,E 127. A,D 128. B 129. A,D 130. B 131. A,D 132. A,D,E,F 133. A 134. B,E 135. C 136. F 137. C 138. D 139. F 140. D,E 141. B 142. A,B 143. B,D 144. C,E 145. C 146. A,E 147. A

搜索更多相关主题的帖子: create Object result 
2004-12-19 15:42
快速回复:129--147题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039255 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved