Java结业测试题(1)
(2011-12-11 17:16:49)
标签:
java结业测试题it |
分类: Java |
Java结业测试题
考试时间:180分钟
选择题: (每题1 分, 共50分)
1.
class Test{
}
How can the member variable m be accessible directly in the method fun()?
A. change private int m to protected int m
B. change private int m to public int m
C. change private int m to static int m
D. change private int m to int m
2.
public void example(){...}
A. public void example( int m){...}
B. public int example(){...}
C. public void example2(){...}
D. public int example ( int m, float f){...}
3.
Which expressions can be used at the point of // assignment x=a, y=b?
A. Base(a,b);
B. x=a, y=b;
C. x=a; y=b;
D. this(a,b);
A. s += "books";
B. char c = s[1];
C. int len = s.length;
D. String t = s.toLowerCase();
5.
A. String
B. int
C. char
D. void
6.
A. fieldname
B. super
C. 3number
D.#number
E. $number
7.
A. const
B. NULL
C. false
D. this
E. native
8.
A. 22
B. 0x22
C. 022
D. 22H
9.
int i = 1;
int j;
j = i++;
A. 1, 1
B. 1, 2
C. 2, 1
D. 2, 2
10.
A. >> is the arithmetic right shift operator.
B. >> is the logical right shift operator.
C. >>> is the arithmetic right shift operator.
D. >>> is the logical right shift operator.
11.
A. float a = 2.0
B. double b = 2.0
C. int c = 2
D. long d = 2
12.
A. char args[]
B. char args[][]
C. String arg[]
D. String args
13.
A. float f[][] = new float[6][6];
B. float []f[] = new float[6][6];
C. float f[][] = new float[][6];
D. float [][]f = new float[6][6];
E. float [][]f = new float[6][];
14.
Which result of the following expressions equals to the number of the array elements?
A. m.length()
B. m.length
C. m.length()+1
D. m.length+1
15.
Which statements are true?
A. args[0] = "MyTest a b c"
B. args[0] = "MyTest"
C. args[0] = "a"
D. args[1]= 'b'
16.
A. Output is null.
B. Output is 0.
C. When compile, some error will occur.
D. When running, some error will occur.
17.
boolean m = true;
if ( m = false )
else
A. False
B. True
C. None
D. An error will occur when running.
18.
public class Test{
}
What will be output after execution?
A. 5
B. 4
C. 6
D. Finished
E. None
19.
A. 0 and 0
B. 0 and 1
C. 0 and 2
D. 1 and 0
E. 1 and 1
F. 1 and 2
G. 2 and 0
H. 2 and 1
I. 2 and 2
20.
A. 0
B. 1
C. 2
D. 3
E. 4
F. None
21.
A. private
B. public
C. protected
D. protect
E. friend
22.
A. private
B. public
C. protected
D. no modifier
E. final
23.
A. static
B. final
C. abstract
D. No modifier can be used
24.
public class Test {
}
Which of the following usage are legal?
A. t.f
B. this.n
C. Test.m
D. Test.n
25.
1) class Example{
2)
3)
4)
5)
6)
7)
8)
9) }
10) class Demo extends Example{
11) }
12) public class Test{
13)
14)
15)
16) }
Which line will cause an error?
A. line 3
B. line 6
C. line 10
D. line 14
E. line 15
26.
class Base {
}
public class Child extends Base{
}
Which methods can be added into the Child class correctly?
A. private void fun( int n ){ //...}
B.void fun ( int n ){ //... }
C. protected void fun ( int n ) { //... }
D. public void fun ( int n ) { //... }
E. public m(){ //... }
27.
A. In Java single inheritance is allowed, which makes code more reliable.
B. A subclass inherits all methods ( including the constructor ) from the superclass.
C. A class can implement as many interfaces as needed.
D. When a class implements an interface, it can define as many methods of the interface as needed.
28.
A. public class test {
B. public class Test{
C. public class Test extends T1, T2 {
29.
Person
There is the following expression in a Java source file:
Which one of the following statements are true?
A. The expression is legal.
B. The expression is illegal.
C. Some errors will occur when compile.
D. Compile is correct but it will be wrong when running.
30.
A. Person
B. Student
C. Teacher
D. Object
E. None of them can be used.