为了减少大家的麻烦,决定将答案同时给出。
11Which statements about inheritance are true?
A. In Java programming language only allows single inheritance.
B. In Java programming language allows a class to implement only one
interface.
C. In Java programming language a class cannot extend a class and
implement a interface together.
D. In Java programming language single inheritance makes code more
reliable.
(a,d)
121) class Person {
2) public void printValue(int i, int j) {//... }
3) public void printValue(int i){//... }
4) }
5) public class Teacher extends Person {
6) public void printValue() {//... }
7) public void printValue(int i) {//...}
8) public static void main(String args[]){
9) Person t = new Teacher();
10) t.printValue(10);
11) }
Which method will the statement on line 10 call?
A. on line 2
B. on line 3
C. on line 6
D. on line 7
(d)
13Which are not Java primitive types?
A. short
B. Boolean
C. unit
D. float
(bc)
14Use the operators "<<", ">>",
which statements are true?
A. 0000 0100 0000 0000 0000 0000 0000 0000<<5 gives
1000 0000 0000 0000 0000 0000 0000 0000
B. 0000 0100 0000 0000 0000 0000 0000 0000<<5 gives
1111 1100 0000 0000 0000 0000 0000 0000
C. 1100 0000 0000 0000 0000 0000 0000 0000>>5 gives
1111 1110 0000 0000 0000 0000 0000 0000
D. 1100 0000 0000 0000 0000 0000 0000 0000>>5 gives
0000 0110 0000 0000 0000 0000 0000 0000
(ac)
15Which of the following range of int is correct?
-27 -- 27-1
0 – 232-1
–215 -- 215-1
–231 -- 231-1
(d)
16Which keyword should be used to enable interaction with the lock
of an object? The flag allows exclusive access to that object.
A. transient
B. synchronized
C. serialize
D. static
(b)
17Which is the return type of the method main()?
A. int
B. void
C. boolean
D. static
(b)
18Given the following code:
if (x>0) { System.out.println("first"); }
else if (x>-3) { System.out.println("second"); }
else { System.out.println("third"); }
Which range of x value would print the string "second"?
A. x > 0
B. x > -3
C. x <= -3
D. x <= 0 & x > -3
(d)
19Given the following expression about TextField which use a proportional
pitch font.
TextField t = new TextField("they are good",40);
Which statement is true?
A. The displayed string can use multiple fonts.
B. The maximum number of characters in a line will be 40.
C. The displayed width is exactly 40 characters.
D. The user can edit the characters.
(d)
20Which statements about the garbage collection are true?
A. The program developer must create a thread to be responsible for
free the memory.
B. The garbage collection will check for and free memory no longer
needed.
C. The garbage collection allow the program developer to explicity
and immediately free the memory.
D. The garbage collection can free the memory used java object at
expect time.
(b)
|