技术开发 频道

Java程序员认证模拟题及详细分析(2)

【IT168 技术文档】

续:Java程序员认证模拟题及详细分析(1)
 
26. Give following class:
 
class AClass{
private long val;
public AClass(long v){val=v;}
public static void main(String args[]){
AClass x=new AClass(10L);
AClass y=new AClass(10L);
AClass z=y;
long a=10L;
int b=10;
}
}
 
Which expression result is true?
 
A. a==b;
B. a==x;
C. y==z;
D. x==y;
E. a==10.0;
 
27. A socket object has been created and connected to a standard internet service on a remote network server. Which construction give the most suitable means for reading ASCII data online at a time from the socket?
 
A. InputStream in=s.getInputStream();
B. DataInputStream in=new DataInputstream(s.getInputStream());
C. ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream());
D. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()));
E. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()),8859-1);
 
28. String s=Example String;
Which operation is legal?
 
A. s>>>=3;
B. int i=s.length();
C. s[3]=x;
D. String short_s=s.trim();
E. String t=root+s;
 
29. What happens when you try to compile and run the following program?
 
class Mystery{
String s;
public static void main(String[] args){
Mystery m=new Mystery();
m.go();
}
void Mystery(){
s=constructor;
}
void go(){
System.out.println(s);
}
}
 
A. this code will not compile
B. this code compliles but throws an exception at runtime
C. this code runs but nothing appears in the standard output
D. this code runs and constructor in the standard output
E. this code runs and writes null in the standard output
 
30. What use to position a Button in a Frame ,only width of Button is affected by the Frame size, which Layout Button well be set ?
 
A. FlowLayout;
B. GridLayout;
C. North of BorderLayout
D. South of BorderLayout
E. East or West of BorderLayout
 
31. What use to position a Button in a Frame, size of Button is not affected by the Frame size, which Layout Button will be set?
 
A. FlowLayout;
B. GridLayout;
C. North of BorderLayout
D. South of BorderLayout
E. East or West of BorderLayout
 
32. An AWT GUI under exposure condition, which one or more method well be invoke when it redraw?
 
A. paint();
B. update();
C. repaint();
D. drawing();
 
33. Select valid identifier of Java:
 
A. userName
B. %passwd
C. 3d_game
D. $charge
E. this
 
34. Which are Java keyword?
 
A. goto
B. null
C. FALSE
D. native
E. const
 
35. Run a corrected class: java ?Ccs AClass a b c
Which statement is true?
 
A. args[0]=-cs;
B. args[1]=a b c;
C. args[0]=java;
D. args[0]=a; E. args[1]=?b?
 
36. Give the following java class:
 
public class Example{
static int x[]=new int[15];
public static void main(String args[]){
System.out.println(x[5]);
}
}
 
Which statement is corrected?
 
A. When compile, some error will occur.
B. When run, some error will occur.
C. Output is zero.
D. Output is null.
 
37. Give the following java class:
 
public class Example{
public static void main(String args[]){
static int x[] = new int[15];
System.out.println(x[5]);
}
}
 
Which statement is corrected?
 
A. When compile, some error will occur.
B. When run, some error will occur.
C. Output is zero.
D. Output is null.
 
38. Short answer:
The decimal value of i is 12, the octal i value is:
 
39. Short answer:
The decimal value of i is 7, the hexadecimal i value is:
 
40. Which is the range of char?
 
A. 27~27-1
B. 0~216-1
C. 0~216
D. 0~28
0
相关文章