Questions of the Second National itat education engineering Employment Skills Competition Java programming Note:Create a folder named by name and admission ticket number in the specified path, and store the answer to the sub-folder named by question number. All candidates whose questions are not stored in the corresponding folder as required will be voided.
I. multiple choice questions (each question has 3 points, a total of 45 points)
| 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(1) which of the following statements about the characteristics of the Java language is false ()
A. Java is a cross-platform programming language B. JAVA supports distributed computing
C. Java is a process-oriented programming language D. JAVA supports Multithreading
(2) which of the following concepts does not belong to object-oriented methods ________.
A. object, message B. Inheritance, polymorphism C. Class, encapsulation D. process call
(3) The three basic control structures stipulated in the structured program design are ()
A. input, processing, and output B. Tree, net, and ring
C. sequence, selection, and loop D. Main Program, subroutine, and function
(4) which of the following statements about constructor is false ()
A. the Java language specifies that the constructor name and class name must be the same.
B. the Java language specifies that the constructor does not return values, but does not use void declarations.
C. the Java language specifies that the constructor cannot be overloaded.
D. Java language requires that the constructor can only be automatically called through new
(5) which of the following classes is correct?
A. Abstract final class Hi {} B. Abstract private move (){}
C. Protected private number; D. Public abstract class car {}
(6) which of the following statements about the member variables modified by the private access controller private is true ()
A. It can be referenced by three types: class itself, other classes in the same package as it, and subclass of the class in other packages.
B. It can be accessed and referenced by two types: the class itself, all subclasses of the class
C. It can only be accessed and modified by the class itself.
D. It can only be accessed by classes in the same package
(7) which of the following statements is legal ()
A. default string s; B. Public final static native int W ()
C. Abstract double D; D. Abstract final double hyperboliccosine () (8) What operations can the applet perform? ()
A. Read client files B. Create new files on the client host
C. Load the library on the client. D. Read some system variables on the client.
(9) which of the following statements about the for loop and while loop are true? ()
A. operations that can be implemented by the while loop can also be implemented by the for loop.
B. While loop judgment conditions are generally program results, and for loop judgment conditions are generally non-program results.
C. Both loops can be replaced at any time
D. Both cycle structures must have a cycle body. The cycle body cannot be blank.
(10) test1 class is defined as follows:
1. Public class test1 {
2. Public float amethod (float a, float B ){}
3.
4 .}
Which of the following methods to insert Row 3 is invalid. ()
A. Public float amethod (float a, float B, float c ){}
B. Public float amethod (float C, float d ){}
C, public int amethod (int A, int B ){}
D. Private float amethod (int A, int B, int c ){}
(11) read the following code:
Import java. Io .*;
Import java. util .*;
Public class Foo {
Public static void main (string [] ARGs ){
String S;
System. Out. println ("s =" + S );
}
}
The output result should be :()
A. The code is compiled and "s =" is output"
B. Compile the code and output "s = NULL"
C. Because string S is not initialized, the Code cannot be compiled
D. The code is compiled, but an nullpointexception exception is caught.
(12) After compiling and running the following program, which of the following statements about the output result is true ()
Public class conditional {
Public static void main (string ARGs []) {
Int x = 4;
System. Out. println ("value is" + (x> 4 )? 99.9: 9 ));
}
}
A. The output result is: value is 99.99 B. The output result is: value is 9.
C. The output result is: value is 9.0 D. Compilation Error
(13) which of the following statements is correct after the code int [] x = new int [10] is executed ()
A. X [9] is 0 B. X [9] undefined C. X [10] is 0 d. X [0] is null
(14) The correct statement about the following program segments is () 1. String S1 = "A" + "B ";
2. String S2 = new string (S1 );
3. If (S1 = S2)
4. system. Out. println ("= is succeeded ");
5. If (s1.equals (S2 ))
6. system. Out. println (". Equals () is succeeded ");
A. Both row 4 and row 6 will execute B. Row 4, and row 6 will not execute
C. Execute Row 6, and do not execute row 4. Do not execute row 4 or row 6.
(15) The running result of the following programs is :()
Public class increment {
Public static void main (string ARGs []) {
Int C;
C = 2;
System. Out. println (C );
System. Out. println (C ++ );
System. Out. println (C );
}
}
A.2 B .2 C.2 D.3
2 3 2 4
2 3 3 4
2. Write the running results of the following programs. (10 points for each question, 30 points in total)
1. Write the running results of the following programs.
Public class changestrdemo {
Public static void changestr (string Str ){
STR = "welcome ";
}
Public static void main (string [] ARGs ){
String STR = "1234 ";
Changestr (STR );
System. Out. println (STR );
}
}
2. Write the running results of the following programs.
Class first {
Public first (){
Amethod ();}
Public void amethod (){
System. Out. println ("in first class ");}
}
Public class second extends first {
Public void amethod (){
System. Out. println ("in Second Class ");}
Public static void main (string [] ARGs ){
New second ();}
} 3. Write the running results of the following programs.
Public class foodemo {
Static Boolean Foo (char c ){
System. Out. Print (C );
Return true;
}
Public static void main (string [] ARGs ){
Int I = 0;
For (FOO ('A'); Foo ('B') & (I <2); Foo ('C ')){
I ++;
Foo ('D ');
}
}
}
Iii. programming questions (45 points)
1. Write a Java program: open a text file and read one line of text at a time. Form a string for each row, and place the read String object in the sorted list. Print all text lines in the shortlist in reverse order.