Java程序员认证模拟试题
来源:优易学  2011-11-28 13:07:11   【优易学:中国教育考试门户网】   资料下载   IT书店

 

51. Which correctly create an array of five empty Strings?
A. String a[] = new String[5];
for (int i=0;i<5;a[i++]=””);
B. String a []={“”,””,””,””,””};
C. String a[5];
D. String [5] a;
E. String [] a = new String[5];
for (int i = 0 ;i<5;a[i++] = null);

52. Which cannot be added to a Container?
A. an Applet
B. a Component
C. a Container
D. a MenuComponent
E. a panel

53. Which is the return value of Event listener?s method?
A. String B. AWTEvent C. void D. int

54. If we implements MouseListener, which is corrected argument of its method? (short answer)

55. Use the operator “>>” and “>>>”. Which statement is true?
A. 1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give
0000 1010 0000 0000 0000 0000 0000 0000
B. 1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give
1111 1010 0000 0000 0000 0000 0000 0000
C. 1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give
0000 1010 0000 0000 0000 0000 0000 0000
D. 1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give
1111 1010 0000 0000 0000 0000 0000 0000

56. Give following fragment.
Outer: for(int i=0; i<3; i++)
inner:for(int j=0;j<3;j++){
If(j>1)break outer;
System.out.println(j+”and”+i);
}
Which will be output?
A. 0 and 0 B. 0 and 1 C. 0 and 2 D. 0 and 3
E. 1 and 0 F. 1 and 1 G. 1 and 2 H. 1 and 3
I. 2 and 0 J. 2 and 1 K. 2 and 2 L. 2 and 3

57. Examine the following code which includes an inner class:
public final class Test4 implements A{
class Inner{
void test(){
if (Test4.this.flag);{
sample();
}
}
private boolean flag=false;
}
public void sample(){
System.out.println(“Sample”);
}
public Test4(){
(new Inner()).test();
}
public static void main(String args[]){
new Test4();
}
}
What is the result:
A.Print out “Sample”
B.Program produces no output but termiantes correctly.
C. Program does not terminate.
D.The program will not compile

58. What is written to the standard output given the following statement:
System.out.println(4|7);
Select the right answer:
A.4
B.5
C.6
D.7
E.0

59. Look the inheritance relation:
person
|
----------------
| |
man woman
In a source of java have the following line:
person p=new man();
What statement are corrected?
A. The expression is illegal.
B. Compile corrected but running wrong.
C. The expression is legal.
D. Will construct a person?s object.

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页

责任编辑:小草

文章搜索:
 相关文章
热点资讯
热门课程培训