📄 scjp认证套题解析之三.htm
字号:
<br>Which value of m would cause "default" to be the output?
<br>A. 0
<br>B. 1
<br>C. 2
<br>D. 3
<br>(cd)
<br>题目:给出下面的代码片断:
<br>…
<br>m为哪些值将导致"default"输出。
<br>此题考察switch语句的用法,switch的判断的条件必须是一个int型值,也可以是byte、short、char型的值,case中需要注意的是一个case后面一般要接一个break语句才能结束判断,否则将继续执行其它case而不进行任何判断,如果没有任何值符合case列出的判断,则执行default的语句,default是可选的,可以没有,如果没有default而又没有任何值匹配case中列出的值则switch不执行任何语句。
<br>
<br>56、Given the uncompleted method:
<br>1)
<br>2) { success = connect();
<br>3) if (success==-1) {
<br>4) throw new TimedOutException();
<br>5) }
<br>6)}
<br>TimedOutException is not a RuntimeException. Which can complete the method of declaration when added at line 1?
<br>A. public void method()
<br>B. public void method() throws Exception
<br>C. public void method() throws TimedOutException
<br>D. public void method() throw TimedOutException
<br>E. public throw TimedOutException void method()
<br>(bc)
<br>题目:给出下面的不完整的方法:
<br>…
<br>TimedOutException 不是一个RuntimeException。下面的哪些声明可以被加入第一行完成此方法的声明。
<br>如果程序在运行的过程中抛出异常,而这个异常又不是RuntimeException或者Error,那么程序必须捕获这个异常进行处理或者声明抛弃(throws)该异常,捕获异常可以使用try{}catch(){}语句,而抛弃异常在方法声明是声明,在方法的声明后面加上throws XxxxException,抛弃多个异常时在各异常间使用逗号(,)分隔,题目中的程序在运行时抛出的不是一个RuntimeException,所有必须捕获或者抛弃,而程序又没有捕获,所有应该在方法声明中声明抛弃。由于Exception是所有异常的父类,所有当然也可以代表RuntimeException了。
<br>
<br>57、Which of the following answer is correct to express the value 10 in hexadecimal number?
<br>A. 0xA
<br>B. 0x16
<br>C. 0A
<br>D. 016
<br>(a)
<br>题目:下面的哪些答案可以正确表示一个十六进制数字10。
<br>十六进制数以0x开头,以0开头的是八进制数。十六进制表示中的a,b,c,d,e,f依次为10,11,12,13,14,15。
<br>
<br>58、Which statements about thread are true?
<br>A. Once a thread is created, it can star running immediately.
<br>B. To use the start() method makes a thread runnable, but it does not necessarily start immediately.
<br>C. When a thread stops running because of pre-emptive, it is placed at the front end of the runnable queue.
<br>D. A thread may cease to be ready for a variety of reasons.
<br>(bd)
<br>题目:有关线程的哪些叙述是对的。
<br>A. 一旦一个线程被创建,它就立即开始运行。
<br>B. 使用start()方法可以使一个线程成为可运行的,但是它不一定立即开始运行。
<br>C. 当一个线程因为抢先机制而停止运行,它被放在可运行队列的前面。
<br>D. 一个线程可能因为不同的原因停止(cease)并进入就绪状态。
<br>一个新创建的线程并不是自动的开始运行的,必须调用它的start()方法使之将线程放入可运行态(runnable state),这只是意味着该线程可为JVM的线程调度程序调度而不是意味着它可以立即运行。线程的调度是抢先式的,而不是分时间片式的。具有比当前运行线程高优先级的线程可以使当前线程停止运行而进入就绪状态,不同优先级的线程间是抢先式的,而同级线程间是轮转式的。一个线程停止运行可以是因为不同原因,可能是因为更高优先级线程的抢占,也可能是因为调用sleep()方法,而即使是因为抢先而停止也不一定就进入可运行队列的前面,因为同级线程是轮换式的,它的运行可能就是因为轮换,而它因抢占而停止后只能在轮换队列中排队而不能排在前面。
<br>
<br>59、The method resume() is responsible for resuming which thread´s execution?
<br>A. The thread which is stopped by calling method stop()
<br>B. The thread which is stopped by calling method sleep()
<br>C. The thread which is stopped by calling method wait()
<br>D. The thread which is stopped by calling method suspend()
<br>(d)
<br>题目:方法resume()负责恢复哪些线程的执行。
<br>A. 通过调用stop()方法而停止的线程。
<br>B. 通过调用sleep()方法而停止运行的线程。
<br>C. 通过调用wait()方法而停止运行的线程。
<br>D. 通过调用suspend()方法而停止运行的线程。
<br>Thread的API文档中的说明是该方法恢复被挂起的(suspended)线程。该方法首先调用该线程的无参的checkAccess() 方法,这可能在当前线程上抛出SecurityException 异常,如果该线程是活着的(alive)但是被挂起(suspend),它被恢复并继续它的执行进程。
<br>
<br>60、Given the following code:
<br>1) public class Test {
<br>2) int m, n;
<br>3) public Test() {}
<br>4) public Test(int a) { m=a; }
<br>5) public static void main(String arg[]) {
<br>6) Test t1,t2;
<br>7) int j,k;
<br>8) j=0; k=0;
<br>9) t1=new Test();
<br>10) t2=new Test(j,k);
<br>11) }
<br>12) }
<br>Which line would cause one error during compilation?
<br>A. line 3
<br>B. line 5
<br>C. line 6
<br>D. line 10
<br>(d)
<br>题目:给出下面的代码:
<br>…
<br>在编译时哪行将导致一个错误。
<br>第10行的声明调用一个带两个参数的Test的构造方法,而该类没有这样的构造方法。
</td>
</tr>
</table>
</TR>
<tr>
<TD style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" vAlign=top width="760" height=11 colspan="2">
<p align="left"><font color="#7A7978">文章类型>> </font><font color="#999999">
认证考试
|</font>
<font color="#7A7978">阅读次数>> </font>
<font color="#999999">588 |</font>
<font color="#7A7978">得分>> </font>
<font color="#999999">1 |</font>
<font color="#7A7978">整理日期>> </font>
<font color="#999999">2005-01-26 |</font>
<font color="#7A7978">整理发布>> </font>
<font color="#999999">rayjrb</font> |</font>
<a href="#remark"><font style="COLOR: #ff0000; TEXT-DECORATION: none">评论评分</font></a><img src="images/new9.gif">
</tr>
</TBODY>
</TABLE>
</CENTER>
</DIV>
<br>
<DIV align=center>
<TABLE cellSpacing=0 cellPadding=0 width=760 border=0>
<TBODY>
<TR>
<TD>
<TABLE borderColor=#000000 cellSpacing=1 cellPadding=2 width=755
border=1><TBODY>
<TR align=middle borderColor=#d2cea4 bgColor=#dcd8b6>
<TD class=fCC3300 width=560 colSpan=2><A name="remark">发表评论</A></TD>
<TD class=fCC3300 width=200 align=right>
<A onmouseover="status='.:: 暂不开放 ::.'; return true" onmouseout="status='';return true"><IMG title=暂不开放 alt=加入收藏夹 hspace=4 src="images/1-bookmark.gif" align=absMiddle border=0></A>
<A onmouseover="status='.:: 暂不开放 ::.'; return true" onmouseout="status='';return true" target=_parent><IMG title=暂不开放 height=18 alt=推荐给朋友 hspace=4 src="images/1-commend.gif" width=59 align=absMiddle border=0></A>
</TD>
</TR>
<FORM name=remark onsubmit="return vdf('SR_SUBJECT','主题','Rlen:2','SR_CONTENT','评论内容','Rsiz:500','SR_GRADE','星级评价','R');" action="technology_detail.jsp" method=post>
<TR>
<TD class=fCC3300 borderColor=#dedcb6 align=middle width=80 bgColor=#e9e7cf>
主 题
</TD>
<TD class=blue borderColor=#e7e4cd width=480 bgColor=#eeecdb height=30>
<INPUT class=editbox1 maxLength=60 size=76 name=SR_SUBJECT value="Re:《SCJP认证套题解析之三》">
<INPUT type=hidden value=3259 name="id">
</TD>
<TD class=blue borderColor=#e7e4cd width=200 bgColor=#eeecdb height=30>
<SELECT class=editbox1 name=SR_GRADE>
<OPTION selected>星级评价...</OPTION>
<OPTION value=5>★★★★★</OPTION>
<OPTION value=4>★★★★</OPTION>
<OPTION value=3>★★★</OPTION>
<OPTION value=2>★★</OPTION>
<OPTION value=1>★</OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD class=fCC3300 borderColor=#dedcb6 align=middle width=80 bgColor=#e9e7cf>
评论内容<BR>500字以内
</TD>
<TD class=blue borderColor=#e7e4cd width=480 bgColor=#eeecdb height=30>
<TEXTAREA class=editbox2 name=SR_CONTENT rows=4 cols=64></TEXTAREA>
<BR>
<div align="center">
<INPUT type=image height=20 width=59 src="images/button_submit.gif" border=0 name=imageField>
<IMG style="CURSOR: hand" onclick=javascript:remark.reset(); height=20 hspace=4
src="images/button_reset.gif" width=59>
</div>
</TD>
<TD class=blue borderColor=#e7e4cd align=middle width=200 bgColor=#eeecdb height=30>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD width=47>
<INPUT type=radio value=1 name=SR_ICON>
<IMG height=13 src="images/icon_small_1.gif" width=13>
</TD>
<TD width=47>
<INPUT type=radio value=2 name=SR_ICON>
<IMG height=13 src="images/icon_small_2.gif" width=13>
</TD>
<TD width=47>
<INPUT type=radio value=3 name=SR_ICON>
<IMG height=13 src="images/icon_small_3.gif" width=13>
</TD>
<TD width=47>
<INPUT type=radio value=4 name=SR_ICON>
<IMG height=13 src="images/icon_small_4.gif" width=13>
</TD>
</TR>
<TR>
<TD width=47>
<INPUT type=radio value=5 name=SR_ICON>
<IMG height=13 src="images/icon_small_5.gif" width=13>
</TD>
<TD width=47>
<INPUT type=radio value=6 name=SR_ICON>
<IMG height=13 src="images/icon_small_6.gif" width=13>
</TD>
<TD>
<INPUT type=radio value=7 name=SR_ICON>
<IMG height=13 src="images/icon_small_7.gif" width=13>
</TD>
<TD>
<INPUT type=radio value=8 name=SR_ICON>
<IMG height=13 src="images/icon_small_8.gif" width=13>
</TD>
</TR>
<TR>
<TD>
<INPUT type=radio CHECKED value=9 name=SR_ICON>
<IMG height=13 src="images/icon_small_9.gif" width=13>
</TD>
<TD>
<INPUT type=radio value=10 name=SR_ICON>
<IMG height=13 src="images/icon_small_10.gif" width=13>
</TD>
<TD>
<INPUT type=radio value=11 name=SR_ICON>
<IMG height=13 src="images/icon_small_11.gif" width=13>
</TD>
<TD>
<INPUT type=radio value=12 name=SR_ICON>
<IMG height=13 src="images/icon_small_12.gif" width=13>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</FORM>
</TBODY>
</TABLE>
</TD>
<TD vAlign=top width=5 background="images/corner_group02_04.gif"><IMG height=5 src="images/corner_group02_01.gif" width=5></TD>
</TR>
<TR>
<TD background="images/corner_group02_02.gif" height=5><IMG height=5 src="images/corner_group02_01.gif" width=5></TD>
<TD width=5 height=5><IMG height=5 src="images/corner_group02_03.gif" width=5></TD>
</TR>
</TBODY>
</TABLE>
<BR>
<TABLE cellSpacing=0 cellPadding=0 width=760 border=0>
<TBODY>
<TR>
<TD>
<TABLE borderColor=#000000 cellSpacing=1 cellPadding=2 width=755
border=1><TBODY>
<TR align=middle borderColor=#d2cea4>
<TD vAlign=bottom width=17 bgColor=#dcd8b6> </TD>
<TD vAlign=bottom width=10 bgColor=#dcd8b6 height=20> </TD>
<TD class=fCC3300 vAlign=bottom width=450 bgColor=#dcd8b6 height=20>主题</TD>
<TD class=fCC3300 vAlign=bottom width=90 bgColor=#dcd8b6 height=20>评论者</TD>
<TD class=fCC3300 vAlign=bottom width=83 bgColor=#dcd8b6 height=20>评论时间</TD>
<TD class=fCC3300 vAlign=bottom borderColor=#d2cea4 align=middle width=110 bgColor=#dcd8b6 height=20>星级评价</TD>
</TR>
<TR borderColor="#e7e4cd" bgColor="#eeecdb">
<TD align=middle width=17>
<IMG src=images/icon_small_1.gif border=0>
</TD>
<TD width=10 height=30>
<IMG language=JScript onmouseup=turnit(img15,tr15) id=img15 style="CURSOR: hand" height=9 src="images/icon_plus.gif" width=9>
</TD>
<TD width=450 height=30>
<A class=black title=Re:《SCJP认证套题解析之三》 href=javascript:turnit(img15,tr15)>
Re:《SCJP认证套题解析之三》
</A>
</TD>
<TD noWrap align=middle width=90 height=30>
<A class=black href=http://www.java-cn.com/members/member_detail.jsp?username=gloryjava&password=>
gloryjava
</A>
</TD>
<TD class=gray noWrap width=83 height=30>
<FONT class=size><IMG src="images/post.gif" border=0>2005-02-15</FONT>
</TD>
<TD align=middle width=110>
<IMG height=14 src="images/dot_01.gif" width=14>
</TD>
</TR>
<TR id=tr15 style="DISPLAY: none" borderColor=#ffffff bgColor=#ffffff>
<TD width=755 colSpan=6>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=40 height=40></TD>
<TD width=755>题看多了/做多了当然有用啊!!!</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
<TD vAlign=top width=5 background="images/corner_group02_04.gif"><IMG height=5 src="images/corner_group02_01.gif" width=5></TD>
</TR>
<TR>
<TD background="images/corner_group02_02.gif" height=5><IMG height=5 src="images/corner_group02_01.gif" width=5></TD>
<TD width=5 height=5><IMG height=5 src="images/corner_group02_03.gif" width=5></TD>
</TR>
</TBODY>
</TABLE>
<BR>
</DIV>
<p align="center">©<a style="COLOR: #0072BC; TEXT-DECORATION: none" href="http://www.java-cn.com/zhuanti/" target=_blank>JAVA中文站技术专题区</a></p>
<p align="center"><input type=button name=close value="关闭窗口" onClick="window.close()" class="rim"></p>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -