📄 中文java技术网scjp考试题310-025(第一套).htm
字号:
AB.<br />
11. You have the following code. Which numbers will cause "Test2" to be<br />
printed?<br />
switch(x){<br />
case 1:<br />
System.out.println("Test1");<br />
case 2:<br />
case 3:<br />
System.out.println("Test2");<br />
break;<br />
}<br />
System.out.println("Test3");<br />
}<br />
A. 0<br />
B. 1<br />
C. 2<br />
D. 3<br />
E. 4<br />
BCD.<br />
12. Which statement declares a variable a which is suitable for<br />
referring to an array of 50 string objects?<br />
A. char a[][];<br />
B. String a[];<br />
C. String []a;<br />
D. Object a[50];<br />
E. String a[50];<br />
F. Object a[];<br />
BCF.<br />
13. What should you use to position a Button within an application<br />
frame so that the width of the Button is affected by the Frame size but<br />
the height is not affected.<br />
A. FlowLayout<br />
B. GridLayout<br />
C. Center area of a BorderLayout<br />
D. East or West of a BorderLayout<br />
E. North or South of a BorderLayout<br />
E.<br />
14. What might cause the current thread to stop executing?<br />
A. An InterruptedException is thrown<br />
B. The thread executes a sleep() call<br />
C. The thread constructs a new Thread<br />
D. A thread of higher priority becomes ready (runnable)<br />
E. The thread executes a read() call on an InputStream<br />
ABDE.<br />
Non-runnable states:<br />
* Suspended: caused by suspend(), waits for resume()<br />
* Sleeping: caused by sleep(), waits for timeout<br />
* Blocked: caused by various I/O calls or by failing to get a monitor's<br />
lock, waits for I/O or for the monitor's lock<br />
* Waiting: caused by wait(), waits for notify() or notifyAll()<br />
* Dead: Caused by stop() or returning from run(), no way out<br />
15. Consider the following code:<br />
String s = null;<br />
Which code fragments cause an object of type NullPointerException to be<br />
thrown?<br />
A. if((s!=null) & (s.length()>0))<br />
B. if((s!=null) &&(s.length()>0))<br />
C. if((s==null) | (s.length()==0))<br />
D. if((s==null) || (s.length()==0))<br />
AC.<br />
16. Given the following method body:<br />
{<br />
if (sometest()) {<br />
unsafe();<br />
}<br />
else {<br />
safe();<br />
}<br />
}<br />
The method "unsafe" might throw an IOException (which is not a subclass<br />
of RunTimeException). Which correctly completes the method of<br />
declaration when added at line one?<br />
A. public void methodName() throws Exception<br />
B. public void methodname()<br />
C. public void methodName() throw IOException<br />
D. public void methodName() throws IOException<br />
E. public IOException methodName()<br />
AD.<br />
17. What would be the result of attempting to compile and run the<br />
following piece of code?<br />
public class Test {<br />
static int x;<br />
public static void main(String args[]){<br />
System.out.println("Value is " + x);<br />
}<br />
}<br />
A. The output "Value is 0" is printed.<br />
B. An object of type NullPointerException is thrown.<br />
C. An "illegal array declaration syntax" compiler error occurs.<br />
D. A "possible reference before assignment" compiler error occurs.<br />
E. An object of type ArrayIndexOutOfBoundsException is thrown.<br />
A.<br />
18. What would be the result of attempting to compile and run the<br />
following piece of code?<br />
public class Test {<br />
public int x;<br />
public static void main(String args[]){<br />
System.out.println("Value is " + x);<br />
}<br />
}<br />
A. The output "Value is 0" is printed.<br />
B. Non-static variable x cannot be referenced from a static context..<br />
C. An "illegal array declaration syntax" compiler error occurs.<br />
D. A "possible reference before assignment" compiler error occurs.<br />
E. An object of type ArrayIndexOutOfBoundsException is thrown.<br />
B.<br />
19. What would be the result of attempting to compile and run the<br />
following piece of code?<br />
public class Test {<br />
public static void main(String args[]){<br />
int x;<br />
System.out.println("Value is " + x);<br />
}<br />
}<br />
A. The output "Value is 0" is printed.<br />
B. An object of type NullPointerException is thrown.<br />
C. An "illegal array declaration syntax" compiler error occurs.<br />
D. A "possible reference before assignment" compiler error occurs.<br />
E. An object of type ArrayIndexOutOfBoundsException is thrown.<br />
D. </td>
<td valign="top" width="14%">
<div align=right><font color=gray> </font></div>
<script type="text/javascript"><!--
google_ad_client = "pub-1552958637257019";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "A8DDA0";
google_color_bg = "EBFFED";
google_color_link = "0000CC";
google_color_url = "008000";
google_color_text = "6F6F6F";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>
<p>
</td>
<td valign="top" width="1%"> </td>
</tr>
<tr>
<td width="99%">
</td>
<td width="1%"> </td>
</tr>
</table>
</td>
<tr>
<td valign=middle height="73">
</td>
</table></td>
<tr>
<td valign=top height="73"> <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="1%" height="31"> </td>
<td width="99%" height="31">
<p align="left"><font color=red><img src='http://www.cn-java.com/images/smalllogo.gif'>整理发布</font></p>
<p align="right"> </p>
<p align="left"> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#DCDCE7"> <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<font color=red>发言人:</font><b>过客</b> 日期:2005-01-06<hr>8 true should be keyword.<br><br><br> <font color=red>发言人:</font><b>huiwu917</b> 日期:2005-01-07<hr>1,sizeof都不是java的关键字,熟悉c或者c++,写惯了asp的高手就要小心喽。<br />
2,所有的关键字都是小写的,instanceof看上去像方法名,但其实是关键字;<br />
3,大写的NULL不是java语言的关键字。<br><br><br> <font color=red>发言人:</font><b>huiwu917</b> 日期:2005-01-07<hr>关键字列表<br />
<br />
abstract boolean break byte case<br />
catch char class continue default<br />
do double else extends false<br />
final finally float for if<br />
implements import instanceof int interface<br />
long native new null package<br />
private protected public return short<br />
static super switch synchronized this<br />
throw throws transient true try<br />
void volatile while <br />
<br />
保留字<br />
const,goto<br />
<br><br><br> <font color=red>发言人:</font><b>huiwu917</b> 日期:2005-01-07<hr>最重要的一点就是所有的关键字都是小写,一看到大写就打杈,呵呵!!简单!<br />
这题是错了!<br><br><br> <font color=red>发言人:</font><b>huiwu917</b> 日期:2005-01-07<hr>最重要的一点就是所有的关键字都是小写,一看到大写就打杈,呵呵!!简单!<br />
这题是错了!<br><br><br> <font color=red>发言人:</font><b>huiwu917</b> 日期:2005-01-07<hr>如果给你一个String 或Float来判断,也判断他们不是,它们只是JAVA里的encapsulation类而已!不是所谓的关键字!<br><br><br> <font color=red>发言人:</font><b>过客</b> 日期:2005-03-20<hr>老大 关键字列表中true是关键字吗?? <br><br><br> <font color=red>发言人:</font><b>过客</b> 日期:2005-04-23<hr>true是关键字<br><br><br> <font color=red>发言人:</font><b>jzhdsun</b> 日期:2005-04-25<hr>非常感谢你的试题<br><br><br> </td>
</tr>
</table></td>
</tr>
</table>
<form method="post" name="formMsg" action="sendPinglun.php?tg=news.php" >
<p><font color="#FF0000"><b>你还没有登录</b> </font><a target='_self' href='../login.php?path_point=http://www.cn-java.com/target/news.php?news_id=3094'>登录</a> <a target='_blank' href='http://www.cn-java.com/user_step1.php'>免费申请一个帐户</a></p><input type=hidden name=news_id value=3094> <p align="left"> 评论内容不超过255个字符<br>
<textarea name="mypinglun" cols="50" rows="4"></textarea>
<input type="submit" class ="unnamed5" name="Submit" value="送出我的评论内容">
</p>
</form>
<p align="right"> </p>
<p align="right"><font size="2"><img src="../images/print.gif" width="23" height="23"><a href="Javascript:js_callpage('./news_print.php?news_id=3094')">打印文章</a><img src="../images/__chazhao.gif" width="20" height="20"><a href="../search_result.php" target='_self'>文章查询</a></font></p></td>
</tr>
<tr>
<td width="1%" bordercolor="#CCCCCC"> </td>
<td bgcolor="#CCCCFF" width="99%">推荐文章</td>
</tr>
<tr>
<td width="1%" bordercolor="#CCCCCC"> </td>
<td width="99%" bgcolor="#EEF7FF">
<ol start=1> <li> <a href='./news.php?news_id=828'><img src='http://www.cn-java.com/images/cool.gif' border=0>SUN认证Java2程序员考试(SCJP) 试题解析</a> </li> <li> <a href='./news.php?news_id=2215'><img src='http://www.cn-java.com/images/cool.gif' border=0>Java程序员(SCJP)和开发员(SCJD)认证</a> </li> <li> <a href='./news.php?news_id=1851'><img src='http://www.cn-java.com/images/cool.gif' border=0>JAVA认证问答</a> </li> <li> <a href='./news.php?news_id=704'><img src='http://www.cn-java.com/images/cool.gif' border=0>SCJP Mock Exam 1</a> </li> <li> <a href='./news.php?news_id=701'><img src='http://www.cn-java.com/images/cool.gif' border=0>SCJP Mock Exam 4</a> </li> <li> <a href='./news.php?news_id=823'><img src='http://www.cn-java.com/images/cool.gif' border=0>Java IT技术认证为什么火?</a> </li> <li> <a href='./news.php?news_id=2218'><img src='http://www.cn-java.com/images/cool.gif' border=0>SCJP认证套题解析之一</a> </li> <li> <a href='./news.php?news_id=581'><img src='http://www.cn-java.com/images/cool.gif' border=0>SCJP认证套题解析卷1</a> </li> <li> <a href='./news.php?news_id=703'><img src='http://www.cn-java.com/images/cool.gif' border=0>SCJP Mock Exam 2</a> </li> <li> <a href='./news.php?news_id=702'><img src='http://www.cn-java.com/images/cool.gif' border=0>SCJP Mock Exam 3</a> </li></ol> </td>
</tr>
<tr>
<td width="1%" bordercolor="#CCCCCC"> </td>
<td width="99%" bgcolor="#CCCCFF"> </td>
</tr>
</table></td>
<tr>
<td valign=top height="73"> </td>
</table>
</td>
</tr>
</table>
<p> </p></body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -