《Java程序员认证模拟题及详细分析(2).docx》由会员分享,可在线阅读,更多相关《Java程序员认证模拟题及详细分析(2).docx(18页珍藏版)》请在金锄头文库上搜索。
1、 Java程序员认证模拟题及详细分析(2)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=1
2、0.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(
3、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”; Whi
4、ch operation is legal? A. s=3; B. int i=s.length(); C. s3=”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=”con
5、structor”; 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 stand
6、ard 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,
7、 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. pain
8、t(); 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. args0=”-cs”; B
9、. args1=”a b c”; C. args0=”java”; D. args0=”a”; E. args1=?b? 36. Give the following java class: public class Example static int x=new int15; public static void main(String args) System.out.println(x5); Which statement is corrected? A. When compile, some error will occur. B. When run, some error will
10、 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 int15; System.out.println(x5); Which statement is corrected? A. When compile, some error will occur. B. When run, some error will occur. C. Ou
11、tput 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. 2727-1 B. 0216-1 C. 0216 D. 028 41. Which is the range of int type? A. -216216-1 B.- 23
12、1231-1 C. -232232-1 D. -264264-1 42. Give the following class: public class Example String str=new String(“good”); char ch= public static void main(String args) Example ex=new Example(); ex.change(ex.str,ex.ch); System.out.println(ex.str ”and” ex.ch); public void change(String str,char ch) str=”test
13、 ok”;ch0=?g? Which is the output: A. good and abc B. good and gbc C. test ok and abc D. test ok and gbc 43. Which code fragments would correctly identify the number of arguments passed via command line to a Java application, exclude the name of the class that is being invoke. A. int count = args.length; B. int count = args.length-1; C. int count=0; while(argscount!=null)count ; D. int count=0;while(!(argscount.equals(“”) count ; 44. FilterOutputStream is the parent class for BufferedOutputStream, DataOutputStream and PrintStream. Which classes are valid argument for the constructor o