会计考友 发表于 2012-8-4 12:33:16

JAVA认证历年真题:310-025精选题(37)

310-025精选题(37)的具体内容如下:
152. Cons ider this class example:
class MyPoint {
void myMethod(){
int x, y;
x = 5; y = 3;
System.out.print("(" + x + ", " + y + ")");
switchCoords(x,y);
System.out.print("(" + x + ", " + y + ")");
}
void switchCoords(int x,int y){
int temp;
temp = x;
x = y;
y = temp;
System.out.print("(" + x + ", " + y + ")");
}
} What is printed to standard output if myMethod() is executed?
A. (5, 3) (5, 3) (5, 3)
B. (5, 3) (3, 5) (3, 5)
C. (5, 3) (3, 5) (5, 3)
C.

会计考友 发表于 2012-8-4 12:33:17

JAVA认证历年真题:310-025精选题(37)

153. To declare an array of 31 floating point numbers representing snowfall for each day of March in Gnome, Alaska, which declarations would be valid?
A. double snow[] =new double;
B. double snow= new array;
C. double snow= new array;
D. double[] snow =new double;
AD.
154. If arr[] contains only positive integer values, what does this function do?
public int guessWhat(int arr[]){
int x = 0;
for(int i = 0; i < arr.length; i++)
x = x < arr ? arr : x;
return x;
}
A. Returns the index of the highest element in the array
B. Returns true/false if there are any elements that repeat in the array
C. Returns how many even numbers are in the array
D. Returns the highest element in the array
E. Returns the number of question marks in the array
D.
155. Consider the code below:
arr = new int;
arr = new int;
arr = new int;
arr = new int;
for(int n = 0; n < 4; n++)
System.out.println ( /*What will work here? */);
Which statement below, when inserted as the body of the for loop, would print the number of values in each row?
A.arr.length();
B.arr.size;
C.arr.size -1;
D.arr ;
E.arr.length;
E.

会计考友 发表于 2012-8-4 12:33:18

JAVA认证历年真题:310-025精选题(37)

156. Which of the following are legal declarations of a two -dimensional array of integers?
A.int a = new int[][];
B.int a = new int;
C.int[]a[] = new int ;
D.int[][]a = new int;
C.
157. Given the variables defined below:
int one = 1;
int two = 2;
char initial = '2';
boolean flag = true;
Which of the following are valid?
A. if ( one ){}
B. if( one = two ){}
C. if( one == two ) {}
D. if( flag ){}
E. switch ( one ) { }
F. switch ( flag ) { }
G. switch ( initial ) { }
CDEG.
页: [1]
查看完整版本: JAVA认证历年真题:310-025精选题(37)