1、home directoryString t = s - directory5. Which are syntactically valid statement at/ point x class Person private int a;public int change(int m) return m; public class Teacher extends Person public int b;public static void main(String arg)Person p = new Person();Teacher t = new Teacher();int i;/ poi
2、nt xA. i = m;B. i = b;C. i = p.a;D. i = p.change(30);E. i = t.b. 6. Which layout manager is used when the frame is resized the buttonss position in the Frame might be changed A. BorderLayoutB. FlowLayoutC. CardLayoutD. GridLayout 7. Given the following code fragment:1) public void create() 2 Vector
3、myVect;3 myVect = new Vector(); 4 Which of the following statements are true A. The declaration on line 2 does not allocate memory space for the variable myVect.B. The declaration on line 2 allocates memory space for a reference to a Vector object.C. The statement on line 2 creates an object of clas
4、s Vector.D. The statement on line 3 creates an object of class Vector.E. The statement on line 3 allocates memory space for an object of class Vector 8. Which of the following answer is correct to express the value 8 in octal number A. 010B. 0x10C. 08D. 0x8 9. Which are not Java keywords A. TRUEB. s
5、izeofC. constD. superE. void 10. Which of the following statements are true A. The equals() method determines if reference values refer to the same object.B. The = operator determines if the contents and type of two separate objects match.C. The equals() method returns true only when the contents of
6、 two objects match.D. The class File overrides equals() to return true if the contents and type of two separate objects match. 11. Which statements about inheritance are true A. In Java programming language only allows single inheritance. B. In Java programming language allows a class to implement o
7、nly 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. 12. 1) class Person 2 public void printValue(int i, int j) /*/ 3 public void printValue(int i)/*.*/ 5) publi
8、c 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 12 Which method will the statement on line 10 call A. on line 2B. on line 3C. on line 6D. on line 7 13. Which a
9、re not Java primitive types A. shortB. BooleanC. unitD. float 14、The method resume() is responsible for resuming which threads execution A. The thread which is stopped by calling method stop()B. The thread which is stopped by calling method sleep()C. The thread which is stopped by calling method wai
10、t()D. The thread which is stopped by calling method suspend()15. Which of the following range of int is correct A. -27 27-1 B. 0 232-1 C. -215 215-1 D. -231 231-1 16. Which keyword should be used to enable interaction with the lock of an object The flag allows exclusive access to that object. A. tra
11、nsientB. synchronizedC. serializeD. static 17. Which is the return type of the method main() A. intB. voidC. boolean18. Given the following code:if (x0) System.out.println(first);else if (x-3) System.out.println(secondelse System.out.println(thirdWhich range of x value would print the string A. x 0B
12、. x -3C. x = -3D. x -3 19、Which of the following answer is correct to express the value 10 in hexadecimal number A. 0xAB. 0x16C. 0AD. 016 20. Which 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 coll
13、ection 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. 21、Given the following code:1) public class Test 2 int m, n;3 publi
14、c Test() 4 public Test(int a) m=a;5 public static void main(String arg) 6 Test t1,t2;7 int j,k;8 j=0; k=0;9 t1=new Test();10 t2=new Test(j,k);11 12 Which line would cause one error during compilation A. line 3B. line 5C. line 6D. line 10 22、Given the uncompleted code of a class:class Person String n
15、ame, department;int age;public Person(String n) name = n;public Person(String n, int a) name = n; age = a;public Person(String n, String d, int a) / doing the same as two arguments version of constructor / including assignment name=n,age=adepartment = d;Which expression can be added at the doing the
16、 same as. part of the constructor A. Person(n,a);B. this(Person(n,a);C. this(n,a);D. this(name,age).23、Which of the following statements about variables and their scopes are true A. Instance variables are member variables of a class.B. Instance variables are declared with the static keyword.C. Local
17、 variables defined inside a method are created when the method is executed.D. Local variables must be initialized before they are used.24、public void test() try oneMethod();System.out.println(condition 1 catch (ArrayIndexOutOfBoundsException e) condition 2 catch(Exception e) condition 3 finally fina
18、lly Which will display if oneMethod run normally A. condition 1B. condition 2C. condition 3D. finally25、Given the following code:public class Test void printValue(int m)do System.out.println(The value is+m);while( -m 10 )public static void main(String arg) int i=10;Test t= new Test();t.printValue(i)
19、;Which will be output A. The value is 8 B. The value is 9C. The value is 10D. The value is 1126、Which of the following statements about declaration are true A. Declaration of primitive types such as boolean, byte and so on does not allocate memory space for the variable.B. Declaration of primitive t
20、ypes such as boolean, byte and so on allocates memory space for the variable.C. Declaration of nonprimitive types such as String, Vector and so on does not allocate memory space for the object.D. Declaration of nonprimitive types such as String, Vector ans so on allocates memory space for the object
21、.27、In the Java API documentation which sections are included in a class document A. The description of the class and its purposeB. A list of methods in its super classC. A list of member variableD. The class hierarchy28、Given the following code:1) public void modify() 2) int i, j, k;3) i = 100;4) w
22、hile ( i 0 ) 5) j = i * 2; 6) System.out.println ( The value of j is + j );7) k = k + 1;8) i-;9) 10 Which line might cause an error during compilation A. line 4B. line 6C. line 7D. line 829、Which of the following statements about variables and scope are true A. Local variables defined inside a metho
23、d are destroyed when the method is exited.B. Local variables are also called automatic variables. C. Variables defined outside a method are created when the object is constructed.D. A method parameter variable continues to exist for as long as the object is needed in which the method is defined.30、A
24、 class design requires that a member variable cannot be accessible directly outside the class. Which modifier should be used to obtain the access control A. publicB. no modifierC. protectedD. private 31、Given the following code fragment:1) String str = null;2) if (str != null) & (str.length() 10) 3
25、System.out.println(more than 104 5) else if (str ! (str.length() 5) 6 System.out.println(less than 57 8) else System.out.println(endWhich line will cause error A. line 1B. line 2C. line 532、Which statements about Java code security are true A. The bytecode verifier loads all classes needed for the e
26、xecution of a program.B. Executing code is performed by the runtime interpreter.C. At runtime the bytecodes are loaded, checked and run in an interpreter.D. The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.33、 Given the following code:public class Personint arr = new int10;public static void main(String a) System.out.println(arr1);Which statement is correct A. When compilation some error will occur.B. It is correct when compilation but will cause error when running.C. The output is zero
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1