1、文思海辉人才学院校园招聘笔试题(JAVA1)姓名:_ 性别:_籍贯(省市或地区):_意向就业城市(无锡/北京/ 上海)_是否接受调剂城市:(是/否)_是否接受调剂项目组(如填“是” ,笔试未通过将有机会调剂到海辉其他项目组):(是/否)_毕业院校:_毕业时间:_ 专业: _英语等级: _日语水平:_ 其它语种:_手机号码(请保持手机顺畅开通):_ 邮件:_ 其他(包括个人其他特长或优势):_ 选择题:(110 题每题 6 分,1115 题每题 8 分)( )1. 给出如下代码:class Test private int m; public static void fun() / some c
2、ode. 如何使成员变量 m 被函数 fun() 直接访问 ?A. 将 private int m 改为 protected int m B. 将 private int m 改为 public int m C. 将 private int m 改为 static int m D. 将 private int m 改为 int m ( )2. 构造方法何时被调用A. 类定义时 B. 创建对象时 C. 调用对象方法时 D. 使用对象的变量时( )3. 指出下列程序运行的结果public class Example tring str=new String(good); charch=a,b,c;
3、 public static void main(String args) Example ex=new Example(); ex.change(ex.str,ex.ch); System.out.print(ex.str+and); System.out.print(ex.ch); public void change(String str,char ch) str=test ok; ch0=g; A good and abc B. good and gbc C. test ok and abc D. test ok and gbc ( )4. 如下哪个不是 Java 中正确的整数表示A.
4、 22 B. 0x22 C. 022 D. 22H ( )5. 编译运行下面的代码,结果是什么class Examplepublic static void main(String args)int i=0;int j=5;out:for( ; ;i+)for(; ; j-) if(ij) break out; System.out.println(i+“ “+j);A. 0 5 B. 1 -1 C. 2 1 D. 0 -1 ( )6. 下面哪个函数是 public void example(). 的重载函数?A. private void example( int m). B. public
5、 int example(). C. public void example2(). D. public int example ( int m, float f). ( )7. 已知如下定义: String s = “story“; 下面哪个表达式是合法的?A. s += “books“; B. char c = s1; C. int len = s.length;D. String t = 100; ( )8. 下列语句片段 int a=10,b=4,c=20,d=6; System.out.println(a+*b+c*-d); 的结果为?A 144 B. 28 C. 140 D. 不能
6、执行( )9. 对象使用时,下面描述错误的是A. 通过“.”运算符调用成员变量和方法 B. 通过成员变量的访问权限设定限制自身对这些变量方法的调用 C. 将一个对象申明为类的成员时,必须在使用前为其分配内存D. 在方法中使用对象作为参数时,采用引用调用 ( )10. 读以下程序:class Polish public static void main(String args) int x = 4;StringBuffer sb = new StringBuffer(“fedcba“);sb.delete(3,6);sb.insert(3, “az“);if(sb.length() 6) x =
7、 sb.indexOf(“b“);sb.delete(x-3), (x-2);System.out.println(sb);运行结果是( )Afzba Bfazba Cazba DCompilation fails( )11. 下面哪个是 main() 函数的合法参数? A. char args B. char args C. String arg D. String args( )12. 对于 catch 子句的排列,下列哪种是正确的:A. 父类在先,子类在后 B. 子类在先,父类在后 C. 有继承关系的异常不能在同一个 try 程序段内 D.如何排列都可以( )13. 下列语句片段: in
8、t a=-67,b=116,c=78; int d=ab System.out.println(d)的结果为?A.70 B.67 C.78 D.56( )14. 以下哪个约束符可用于定义成员常量?A static B final C abstract D finally( )15. 读下列程序:import java.io.*;class Player Player() System.out.print(“p“); class CardPlayer extends Player implements Serializable CardPlayer() System.out.print(“c“)
9、; public static void main(String args)CardPlayer cl = new CardPlayer();try FileOutputStream fos = new FileOutputStream(“play.txt“);ObjectOutputStream os = new ObjectOutputStream(fos);os.writeObject(c1);os.close() ;FileInputStream fis = new FileInputStream(“play.txt“);ObjectInputStream is = new ObjectInputStream(fis);CardPlayer c2 = (CardPlayer) is.readObject();is.close(); catch (Exception x ) 运行结果是什么?A. pcc B. pcp C. pcpc D. Compilation fails.答题结果请填写:1 2 3 4 56 7 8 9 1011 12 13 14 15