当前位置:首页 > 全部子站 > IT > 思科认证

SCJP考试题310-025(第二套)51-91/147

来源:长理培训发布时间:2017-12-19 11:15:47

 这是第2套题中的51-90题
310-025 
Leading the way in IT testing and certification tools, www.testking.com 
Question No 51 
Exhibit: 
1. import java.io.IOException; 
2. public class ExceptionTest( 
3. public static void main (String[]args) 
4. try ( 
5. methodA(); 
6. ) catch (IOException e) ( 
7. system.out.printIn("Caught IOException"); 
8. ) catch (Exception e) ( 
9. system.out.printIn("Caught Exception"); 
10. ) 
11. ) 
12. public void methodA () { 
13. throw new IOException (); 
14. ) 
15. ) 
What is the result? 
A. The code will not compile. 
B. The output is caught exception. 
C. The output is caught IOException. 
D. The program executes normally without printing a message. 
Answer: A 
Question No 52 
Exhibit: 
1. public class test { 
2. public static string output = "" 
3. 
4. public static void foo(int i) { 
5. try { 
6. if(i= =1) { 
7. throw new Exception (); 
8. } 
9. output += "1"; 
10. ) 
11. catch(Exception e) { 
12. output += "2"; 
13. return; 
14. ) 
15. finally ( 
16. output += "3"; 
17. ) 
18. output += "4"; 
19. ) 
20. 
21. public static void main (string args[]) ( 
22. foo(0); 
23. foo(1); 
24. 
25. ) 
26. ) 
What is the value of the variable output at line 24? 
Answer: 13423 
Question No 53 
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 exists without printing anything. 
C. An error at line 1 causes compilation to fail. 
D. An error at line 2 causes the compilation to fail. 
E. "Running" is printed and the program exits. 
Answer: D 
Question No 54 
Which statement is true? 
A. If only one thread is blocked in the wait method of an object, and another thread executes the 
modify on that same object, then the first thread immediately resumes execution. 
B. If a thread is blocked in the wait method of an object, and another thread executes the notify 
method on the same object, it is still possible that the first thread might never resume execution. 
C. If a thread is blocked in the wait method of an object, and another thread executes the notify 
method on the same object, then the first thread definitely resumes execution as a direct and sole 
consequence of the notify call. 
D. If two threads are blocked in the wait method of one object, and another thread executes the notify 
method on the same object, then the first thread that executed the wait call first definitely resumes 
execution as a direct and sole consequence of the notify call. 
Answer: B 
Question No 55 
Which two CANNOT directly cause a thread to stop executing? (Choose Two) 
A. Calling the yield method. 
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 start method on another Thread object. 
Answer: C, D 
Question No 56 
Which two can be used to create a new Thread? (Choose Two) 
A. Extend java.lang.Thread and override the run method. 
B. Extend java.lang.Runnable and override the start method. 
C. Implement java.lang.thread and implement the run method. 
D. Implement java.lang.Runnable and implement the run method. 
E. Implement java.lang.Thread and implement the start method. 
Answer: A, D 

责编:罗莉

发表评论(共0条评论)
请自觉遵守互联网相关政策法规,评论内容只代表网友观点,发表审核后显示!

国家电网校园招聘考试直播课程通关班

  • 讲师:刘萍萍 / 谢楠
  • 课时:160h
  • 价格 4580

特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关

配套通关班送国网在线题库一套

课程专业名称
讲师
课时
查看课程

国家电网招聘考试录播视频课程

  • 讲师:崔莹莹 / 刘萍萍
  • 课时:180h
  • 价格 3580

特色解密新课程高频考点,免费学习,助力一次通关

配套全套国网视频课程免费学习

课程专业名称
讲师
课时
查看课程
在线题库
面授课程更多>>
图书商城更多>>
在线报名
  • 报考专业:
    *(必填)
  • 姓名:
    *(必填)
  • 手机号码:
    *(必填)
返回顶部