📄 51-65.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Meta http-equiv="Pragma" Content="No-cach">
<title>Java程序员认证模拟题及详细分析(3) -- 最大的IT资源网</title>
<link href="/img/P5-06-css.css" rel="stylesheet" type="text/css">
</head>
<script language="JavaScript">
function GetContentWnd(){ return parent; }
function OnSave(){
var oWnd = GetContentWnd();
window.external.addFavorite(
oWnd.location.href, oWnd.document.title );
}
//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{
timer=setInterval ("scrollwindow()",80);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos !=document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
</script>
<Script LANGUAGE="JavaScript">
if(self!=top){top.location=self.location;}
</script>
<body oncontextmenu="return false;" onload="setimg();">
<table width="750" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td height="26" valign="top"><table width="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td height="22" align="center"><script src="/js/P5-head.js"></script></td>
</tr>
</table></td>
</tr>
<tr>
<td height="82" align="center" valign="top"
bgcolor="#D2D2D2"><table width="750" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td height="80" align="center" bgcolor="#FFFFFF"><script src="/ad/k15-5-1.js"></script></td>
</tr>
</table></td>
</tr>
<tr>
<td height="30" valign="top"><table width="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td width="85" height="30"><img src="/img/P5-06-01.gif"
width="85" height="30"></td>
<td width="85"><a href="javascript:OnSave();"><img
src="/img/P5-06-02.gif" width="85" height="30" border="0"></a></td>
<td width="8" align="center" valign="top"><img src="/img/P5-06
-03.gif" width="8" height="8"></td>
<td width="8" align="left" valign="bottom"
bgcolor="#F2F2F2"><img src="/img/P5-06-04.gif" width="8"
height="8"></td>
<td width="10" bgcolor="#F2F2F2"> </td>
<td width="418" bgcolor="#F2F2F2"><a href="/">豆豆首页</a> - <a href="http://www.ddvip.net/index.htm">在线教程</a> - <a href="/cert/index.htm">认证考试</a> - <a href="/cert/java/index.htm">JAVA认证</a> - <a href="/cert/java/index3/index.htm">培训资源</a></td>
<td width="136" bgcolor="#F2F2F2"><marquee scrollamount="4">最
大的中文IT资源网
</marquee></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" align="left" cellpadding="0"
cellspacing="0">
<tr>
<td valign="top"><table width="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
<td align="center"> </td>
<td width="20" rowspan="2"> </td>
</tr>
<tr>
<td height="50" align="center" style="border-bottom:1px
dashed #666666"><strong class="f16">Java程序员认证模拟题及详细分析(3)</strong></td>
</tr>
<tr>
<td height="40" align="center"> 作者:unknown 更新时间:
2005-03-22 </td>
<td rowspan="6" valign="top" style="border-right:1px solid
#666666"> </td>
</tr>
<tr>
<td height="40"> </td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0"
cellspacing="0" class="pagefont">
<tr>
<td><p class="line-height"><br>
<span class="header">续:Java程序员认证模拟题及分析(1) 和(2)</span><br>
51. Which correctly create an array of five empty Strings? <br>
A. String a[] = new String[5]; <br>
for (int i=0;i<5;a[i++]=””); <br>
B. String a []={“”,””,””,””,””}; <br>
C. String a[5]; <br>
D. String [5] a; <br>
E. String [] a = new String[5]; <br>
for (int i = 0 ;i<5;a[i++] = null); <br>
<br>
52. Which cannot be added to a Container? <br>
A. an Applet <br>
B. a Component <br>
C. a Container <br>
D. a MenuComponent <br>
E. a panel <br>
<br>
53. Which is the return value of Event listener?s method? <br>
A. String B. AWTEvent C. void D. int <br>
<br>
54. If we implements MouseListener, which is corrected argument of its method? (short answer) <br>
<br>
55. Use the operator “>>” and “>>>”. Which statement is true? <br>
A. 1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give <br>
0000 1010 0000 0000 0000 0000 0000 0000 <br>
B. 1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give <br>
1111 1010 0000 0000 0000 0000 0000 0000 <br>
C. 1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give <br>
0000 1010 0000 0000 0000 0000 0000 0000 <br>
D. 1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give <br>
1111 1010 0000 0000 0000 0000 0000 0000 <br>
<br>
56. Give following fragment. <br>
Outer: for(int i=0; i<3; i++) <br>
inner:for(int j=0;j<3;j++){ <br>
If(j>1)break outer; <br>
System.out.println(j+”and”+i); <br>
} <br>
Which will be output? <br>
A. 0 and 0 B. 0 and 1 C. 0 and 2 D. 0 and 3 <br>
E. 1 and 0 F. 1 and 1 G. 1 and 2 H. 1 and 3 <br>
I. 2 and 0 J. 2 and 1 K. 2 and 2 L. 2 and 3 <br>
<br>
57. Examine the following code which includes an inner class: <br>
public final class Test4 implements A{ <br>
class Inner{ <br>
void test(){ <br>
if (Test4.this.flag);{ <br>
sample(); <br>
} <br>
} <br>
private boolean flag=false; <br>
} <br>
public void sample(){ <br>
System.out.println(“Sample”); <br>
} <br>
public Test4(){ <br>
(new Inner()).test(); <br>
} <br>
public static void main(String args[]){ <br>
new Test4(); <br>
} <br>
} <br>
What is the result: <br>
A.Print out “Sample” <br>
B.Program produces no output but termiantes correctly. <br>
C. Program does not terminate. <br>
D.The program will not compile <br>
<br>
58. What is written to the standard output given the following statement: <br>
System.out.println(4|7); <br>
Select the right answer: <br>
A.4 <br>
B.5 <br>
C.6 <br>
D.7 <br>
E.0 <br>
<br>
59. Look the inheritance relation: <br>
person <br>
| <br>
---------------- <br>
| | <br>
man woman <br>
In a source of java have the following line: <br>
person p=new man(); <br>
What statement are corrected? <br>
A. The expression is illegal. <br>
B. Compile corrected but running wrong. <br>
C. The expression is legal. <br>
D. Will construct a person?s object. <br>
60. Look the inheritance relation: <br>
person <br>
| <br>
---------------- <br>
| | <br>
man woman <br>
In a source of java have the following line: <br>
woman w=new man(): <br>
<br>
What statement are corrected? <br>
A. The expression is illegal. <br>
B. Compile corrected but running wrong. <br>
C. The expression is legal. <br>
D. Will construct a woman object. <br>
<br>
61. Which can NOT be used in declaring or declaring and initializing an automatic (method local) variable? <br>
A. final <br>
B. static <br>
C. expressions <br>
D. Constants of non-primitive type <br>
E. initialized arrays (such as “ {“Hello”,”Good bye”}”). <br>
<br>
62. Given the following incomplete method: <br>
1) public void method(){ <br>
2) <br>
3) if (someTestFails()){ <br>
4) <br>
5) } <br>
6) <br>
7) } <br>
You want to make this method throw an IOException if,and only if,the method someTestFails() returns a value of true. <br>
Which changes achieve this? <br>
A. Add at line 2:IOException e; <br>
B. Add at line 4:throw e; <br>
C. Add at line 4:throw new IOException(); <br>
D. Add at line 6:throw new IOException(); <br>
E. Modify the method declaration to indicate that an object of type Exception might be thrown. <br>
63. Given the following definition: <br>
String s = null; <br>
Which code fragments cause an object of type NullPointerException to be 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>
<br>
64. The following is a program <br>
1) class Exsuper{ <br>
2) String name; <br>
3) String nick_name; <br>
4) <br>
5) public ExSuper(String s,String t){ <br>
6) name = s; <br>
7) nick_name = t; <br>
8) } <br>
9) <br>
10) public string toString(){ <br>
11) return name; <br>
12) } <br>
13) } <br>
14) <br>
15) public class Example extends ExSuper{ <br>
16) <br>
17) public Example(String s,String t){ <br>
18) super(s,t); <br>
19) } <br>
20) <br>
21) public String to String(){ <br>
22) return name +”a.k.a”+nick_name; <br>
23) } <br>
24) <br>
25) public static void main(String args[]){ <br>
26) ExSuper a = new ExSuper(“First”,”1st”); <br>
27) ExSuper b = new Example(“Second”,”2nd”); <br>
28) <br>
29) System.out.println(“a is”+a.toString()); <br>
30) System.out.println(“b is”+b.toString()); <br>
31) } <br>
32) } <br>
What happens when the user attempts to compile and run this program? <br>
A. A Compiler error occurs at line 21 <br>
B. An object of type ClassCastException is thrown at line 27 <br>
C.The following output: <br>
a is First <br>
b is second <br>
D. The following output: <br>
a is First <br>
b is Secong a.k.a 2nd <br>
F. The following output: <br>
a is First a.k.a 1st <br>
b is Second a.k.a 2nd <br>
<br>
65. Which statements are true about Listeners? <br>
A. At most one listener can be added to any simple Component. <br>
B. The return value from a listener is used to control the invocation of other listener <br>
C. If multiple listeners are added to a single component, they must all be made friends to each other <br>
D. If multiple listeners are added to single component, the order of invocation of the listener is not specified. <br>
E. In the AWT, listener methods generally take an argument, which is an instance of some subclass of java.awt.AWTEvent class. <br>
<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -