1、0,2;0,1;1,2;A. i=0 j=0 B. i=0 j=1 C. i=0 j=2 D. i=1 j=0 E. i=1 j=1 F. i=1 j=2 G. i=2 j=0 H. i=2 j=1 I. i=2 j=2 B C F3. What gets printed when the following code is compiled and run with the following command - java test 2 Select the one correct answer.public class test public static void main(String
2、 args) Integer intObj=Integer.valueOf(argsargs.length-1); int i = intObj.intValue(); if(args.length 1) System.out.println(i); 0) System.out.println(i - 1); else System.out.println(i - 2); 4. A. test B. test -1 C. 0 D. 1 E. 2 B5. In Java technology what expression can be used to represent number of e
3、lements in an array named arr ? arr.length6. How would the number 5 be represented in hex using up-to four characters. Ox05 十六进制中的表示为0X-,八进制为0-7. Which of the following is a Java keyword. Select the four correct answers. A. extern B. synchronized C. volatile D. friend E. friendly F. transient G. thi
4、s H. then B C F G8. Is the following statement true or false. The constructor of a class must not have a return type. A. true B. false 9. What is the number of bytes used by Java primitive long. Select the one correct answer. A. The number of bytes is compiler dependent. B. 2 C. 4 D. 8 E. 64 E10. Wh
5、at is returned when the method substring(2, 4) is invoked on the string example? Include the answer in quotes as the result is of type String. am 第二个开始持续2个11. Which of the following is correct? Select the two correct answers. A. The native keyword indicates that the method is implemented in another
6、language like C/C+. B. The only statements that can appear before an import statement in a Java file are comments. C. The method definitions inside interfaces are public and abstract. They cannot be private or protected. D. A class constructor may have public or protected keyword before them, nothin
7、g else. A D12. What is the result of evaluating the expression 14 23. Select the one correct answer. A. 25 异或 01110跟10111 11001B. 37 C. 6 D. 31 E. 17 F. 9 G. 24 A13. Which of the following are true. Select the one correct answers. A. & operator is used for short-circuited logical AND. B. operator is
8、 the bit-wise XOR operator. C. | operator is used to perform bitwise OR and also short-circuited logical OR. D. The unsigned right shift operator in Java is . A14. Name the access modifier which when used with a method, makes it available to all the classes in the same package and to all the subclas
9、ses of the class. public15. Which of the following is true. Select the two correct answers. A. A class that is abstract may not be instantiated. B. The final keyword indicates that the body of a method is to be found elsewhere. The code is written in non-Java language, typically in C/C+. C. A static
10、 variable indicates there is only one copy of that variable. D. A method defined as private indicates that it is accessible to all other classes in the same package. A C16. What all gets printed when the following program is compiled and run. Select the two correct answers. int i, j=1; i = (j1)?2:1;
11、 i=1 switch(i) case 0: System.out.println(0); break; case 1: System.out.println(1); case 2: System.out.println(2); case 3: System.out.println(3);17. A. 0 B. 1 C. 2 D. 3 B C18. What all gets printed when the following program is compiled and run. Select the one correct answer. int i=0, j=2; do i=+i;
12、j-; while(j0);D. The program does not com pilebecause ofstatement i=+i; C 19. What all gets printed when the following gets compiled and run. Select the three correct answers. int i=1, j=1; try i+; if(i/j 1) catch(ArithmeticException e) catch(ArrayIndexOutOfBoundsException e) catch(Exception e) fina
13、lly System.out.println(4);D. 3 E. 4 B D E20. What all gets printed when the following gets compiled and run. Select the two correct answers. if(i = j)21. E. 4 D E22. What all gets printed when the following gets compiled and run. Select the two correct answers. String s1 = abc; String s2 = if(s1 = s
14、2) else if(s1.equals(s2)23. A. 1 C. 3 D. 4 A C24. What all gets printed when the following gets compiled and run. Select the two correct answers. String s2 = new String();25. Which of the following are legal array declarations. Select the three correct answers. A. int i5;B. int i;C. int i;D. int i55
15、;E. int a; B C E26. What is the range of values that can be specified for an int. Select the one correct answer. A. The range of values is compiler dependent. B. -231 to 231 - 1 C. -231-1 to 231 D. -215 to 215 - 1 E. -215-1 to 215 B27. How can you ensure that the memory allocated by an object is fre
16、ed. Select the one correct answer. A. By invoking the free method on the object. B. By calling system.gc() method. C. By setting all references to the object to new values (say null). D. Garbage collection cannot be forced. The programmer cannot force the JVM to free the memory used by an object. D2
17、8. What gets printed when the following code is compiled and run. Select the one correct answer. int i = 1; i-; while (i 2);29. D. -1 A30. Which of these is a legal definition of a method named m assuming it throws IOException, and returns void. Also assume that the method does not take any argument
18、s. Select the one correct answer. A. void m() throws IOException B. void m() throw IOException C. void m(void) throws IOException D. m() throws IOException E. void m() throws IOException A31. Which of the following are legal identifier names in Java. Select the two correct answers. A. %abcd B. $abcd
19、 C. 1abcd D. package E. _a_long_name A C32. At what stage in the following method does the object initially referenced by s becomes available for garbage collection. Select the one correct answer. void method X() String r = new String( String s = new String( r = r+1; /1 r = null; /2 s = s + r; /3 /4
20、A. Before statement labeled 1 B. Before statement labeled 2 C. Before statement labeled 3 D. Before statement labeled 4 E. Never. C33. String s = new String(xyzAssuming the above declaration, which of the following statements would compile. Select the one correct answer. A. s = 2 * s;B. int i = s0;C
21、. s = s + s;D. s = s E. None of the above. C34. Which of the following statements related to Garbage Collection are correct. Select the two correct answers. A. It is possible for a program to free memory at a given time. B. Garbage Collection feature of Java ensures that the program never runs out o
22、f memory. C. It is possible for a program to make an object available for Garbage Collection. D. The finalize method of an object is invoked before garbage collection is performed on the object. C D35. If a base class has a method defined as void method() Which of the following are legal prototypes
23、in a derived class of this class. Select the two correct answers. A. void method() B. int method() return 0; C. void method(int i) D. private void method() A36. In which all cases does an exception gets generated. Select the two correct answers. int i = 0, j = 1;A. if(i = 0) | (j/i = 1) B. if(i = 0)
24、 | (j/i = 1) C. if(i != 0) & (j/i = 1) D. if(i ! (j/i = 1) D37. Which of the following statements are true. Select the two correct answers. A. The wait method defined in the Thread class, can be used to convert a thread from Running state to Waiting state. B. The wait(), notify(), and notifyAll() methods must be executed in synchronized cod
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1