📄 26-50.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Meta http-equiv="Pragma" Content="No-cach">
<title>Java程序员认证模拟题及详细分析(2) -- 最大的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程序员认证模拟题及详细分析(2)</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) </span><br>
26. Give following class: <br>
class AClass{ <br>
private long val; <br>
public AClass(long v){val=v;} <br>
public static void main(String args[]){ <br>
AClass x=new AClass(10L); <br>
AClass y=new AClass(10L); <br>
AClass z=y; <br>
long a=10L; <br>
int b=10; <br>
} <br>
} <br>
Which expression result is true? <br>
A. a==b; <br>
B. a==x; <br>
C. y==z; <br>
D. x==y; <br>
E. a==10.0; <br>
<br>
27. A socket object has been created and connected to a standard internet service on a remote network server. Which construction give the most suitable means for reading ASCII data online at a time from the socket? <br>
A. InputStream in=s.getInputStream(); <br>
B. DataInputStream in=new DataInputstream(s.getInputStream()); <br>
C. ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream()); <br>
D. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream())); <br>
E. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()),”8859-1”); <br>
<br>
28. String s=”Example String”; <br>
Which operation is legal? <br>
A. s>>>=3; <br>
B. int i=s.length(); <br>
C. s[3]=”x”; <br>
D. String short_s=s.trim(); <br>
E. String t=”root”+s; <br>
<br>
29. What happens when you try to compile and run the following program? <br>
class Mystery{ <br>
String s; <br>
public static void main(String[] args){ <br>
Mystery m=new Mystery(); <br>
m.go(); <br>
} <br>
void Mystery(){ <br>
s=”constructor”; <br>
} <br>
void go(){ <br>
System.out.println(s); <br>
} <br>
} <br>
A. this code will not compile <br>
B. this code compliles but throws an exception at runtime <br>
C. this code runs but nothing appears in the standard output <br>
D. this code runs and “constructor” in the standard output <br>
E. this code runs and writes ”null” in the standard output <br>
<br>
30. What use to position a Button in a Frame ,only width of Button is affected by the Frame size, which Layout Button well be set ? <br>
A. FlowLayout; <br>
B. GridLayout; <br>
C. North of BorderLayout <br>
D. South of BorderLayout <br>
E. East or West of BorderLayout <br>
31. What use to position a Button in a Frame, size of Button is not affected by the Frame size, which Layout Button will be set? <br>
A. FlowLayout; <br>
B. GridLayout; <br>
C. North of BorderLayout <br>
D. South of BorderLayout <br>
E. East or West of BorderLayout <br>
<br>
32. An AWT GUI under exposure condition, which one or more method well be invoke when it redraw? <br>
A. paint(); <br>
B. update(); <br>
C. repaint(); <br>
D. drawing(); <br>
<br>
33. Select valid identifier of Java: <br>
A. userName <br>
B. %passwd <br>
C. 3d_game <br>
D. $charge E. this <br>
<br>
34. Which are Java keyword? <br>
A. goto <br>
B. null <br>
C. FALSE <br>
D. native <br>
E. const <br>
<br>
35. Run a corrected class: java ?Ccs AClass a b c <br>
Which statement is true? <br>
A. args[0]=”-cs”; <br>
B. args[1]=”a b c”; <br>
C. args[0]=”java”; <br>
D. args[0]=”a”; E. args[1]=?b? <br>
36. Give the following java class: <br>
public class Example{ <br>
static int x[]=new int[15]; <br>
public static void main(String args[]){ <br>
System.out.println(x[5]); <br>
} <br>
} <br>
Which statement is corrected? <br>
A. When compile, some error will occur. <br>
B. When run, some error will occur. <br>
C. Output is zero. <br>
D. Output is null. <br>
<br>
37. Give the following java class: <br>
public class Example{ <br>
public static void main(String args[]){ <br>
static int x[] = new int[15]; <br>
System.out.println(x[5]); <br>
} <br>
} <br>
Which statement is corrected? <br>
A. When compile, some error will occur. <br>
B. When run, some error will occur. <br>
C. Output is zero. <br>
D. Output is null. <br>
<br>
38. Short answer: <br>
The decimal value of i is 12, the octal i value is: <br>
<br>
39. Short answer: <br>
The decimal value of i is 7, the hexadecimal i value is: <br>
<br>
40. Which is the range of char? <br>
A. 27~27-1 <br>
B. 0~216-1 <br>
C. 0~216 <br>
D. 0~28 <br>
41. Which is the range of int type? <br>
A. -216~216-1 <br>
B.- 231~231-1 <br>
C. -232~232-1 <br>
D. -264~264-1 <br>
<br>
42. Give the following class: <br>
public class Example{ <br>
String str=new String(“good”); <br>
char ch[]={ <br>
public static void main(String args[]){ <br>
Example ex=new Example(); <br>
ex.change(ex.str,ex.ch); <br>
System.out.println(ex.str+”and”+ex.ch); <br>
} <br>
public void change(String str,char ch[]){ <br>
str=”test ok”;ch[0]=?g? <br>
} <br>
} <br>
Which is the output: <br>
A. good and abc <br>
B. good and gbc <br>
C. test ok and abc <br>
D. test ok and gbc <br>
<br>
43. Which code fragments would correctly identify the number of arguments passed via command line to a Java application, exclude the name of the class that is being invoke. <br>
A. int count = args.length; <br>
B. int count = args.length-1; <br>
C. int count=0; while(args[count]!=null) <br>
count++; <br>
D. int count=0;while <br>
(!(args[count].equals(“”))) count++; <br>
<br>
44. FilterOutputStream is the parent class for BufferedOutputStream, DataOutputStream and PrintStream. Which classes are valid argument for the constructor of a FilterOutputStream? <br>
A. InputStream <br>
B. OutputStream <br>
C. File <br>
D. RandomAccessFile <br>
E. StreamTokenizer <br>
<br>
45. Given a TextArea using a proportional pitch font and constructed like this: <br>
TextArea t=new TextArea(“12345”,5,5); <br>
Which statement is true? <br>
A. The displayed width shows exactly five characters one each line unless otherwise constrained <br>
B. The displayed height is five lines unless otherwise constrained <br>
C. The maximum number of characters in a line will be five <br>
D. The user will be able to edit the character string <br>
E. The displayed string can use multiple fonts <br>
46. Given a List using a proportional pitch font and constructed like this: <br>
List l=new List(5,true); <br>
Which statement is true? <br>
A. The displayed item exactly five lines unless otherwise constrained <br>
B. The displayed item is five lines init, but can displayed more than five Item by scroll <br>
C. The maximum number of item in a list will be five. <br>
D. The list is multiple mode <br>
<br>
47. Given this skeleton of a class currently under construction: <br>
public class Example{ <br>
int x,y,z; <br>
<br>
public Example (int a, int b) { <br>
//lots of complex computation <br>
x=a; y=b; <br>
} <br>
public Example(int a, int b, int c){ <br>
// do everything the same as single argument <br>
// version of constructor <br>
// including assignment x=a, y=b, z=c <br>
z=c; <br>
} <br>
} <br>
What is the most concise way to code the “do everything…” part of the constructor taking two arguments? <br>
Short answer: <br>
<br>
48. Which correctly create a two dimensional array of integers? <br>
A. int a[][] = new int[][]; <br>
B. int a[10][10] = new int[][]; <br>
C. int a[][] = new int[10][10]; <br>
D. int [][]a = new int[10][10]; <br>
E. int []a[] = new int[10][10]; <br>
<br>
49. Which are correct class declarations? Assume in each case that the text constitutes the entire contents of a file called Fred.java? <br>
A. public class Fred{ <br>
public int x = 0; <br>
public Fred (int x){ <br>
this.x=x; <br>
} <br>
} <br>
B. public class fred{ <br>
public int x = 0; <br>
public Fred (int x){ <br>
this.x=x; <br>
} <br>
} <br>
C. public class Fred extends MyBaseClass, MyOtherBaseClass{ <br>
public int x = 0; <br>
public Fred(int xval){ <br>
x=xval; <br>
} <br>
} <br>
D. protected class Fred{ <br>
private int x = 0; <br>
private Fred (int xval){ <br>
x=xval; <br>
} <br>
} <br>
E. import java.awt.*; <br>
public class Fred extends Object{ <br>
int x; <br>
private Fred(int xval){ <br>
x = xval; <br>
} <br>
} <br>
50. A class design requires that a particular member variable must be accessible for direct access by any subclasses of this class. but otherwise not by classes which are not members of the same package. What should be done to achieve this? <br>
A. The variable should be marked public <br>
B. The variable should be marked private <br>
C. The variable should be marked protected <br>
D. The variable should have no special access modifier <br>
E. The variable should be marked private and an accessor method provided <br>
<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -