面试前头总有笔试

 

blogger 写道
周三有幸参与了一趟武汉华为研究院的限量版招聘场,通过某些途径笔者在笔试前就得到了此套题
这题目出的好不好,大家仁者见仁,倒是最后一题我是认为很有迷惑性的
不过没关系,目的达到就好,放在这里,需要的同学随便看看散场便可。
PS:那些打乱格式的code均来自元Word文档  另外,答案仅供参考
 

 

 

1 判断题

<!--[if !supportLists]-->(1)         <!--[endif]-->Java中数组可以动态创建  不正确 java中没有动态数组 不过可以用ArrayList

<!--[if !supportLists]-->(2)         <!--[endif]-->一个Java文件中只能包括一个public的类 正确

<!--[if !supportLists]-->(3)         <!--[endif]-->Int数据类型的长度在不同操作系统平台上不同 正确   

<!--[if !supportLists]-->(4)         <!--[endif]-->Java通过super.method()来调用父类的方法  正确 (如果该方法没有被子类及其父类重写的话,直接用子类对象就可以调用了)

<!--[if !supportLists]-->(5)         <!--[endif]-->List以特定的次序持有元素,内中的元素可以重复 正确(set是一种不包含重复元素)

2 单项选择题

<!--[if !supportLists]-->(1)         <!--[endif]-->如下代码运行后,ij的值分别为:( D

int i=0;

int j=++I;

     A0,0    B0,1    C1,0    D1,1

2Java类中,关键字classpackageimport的声明顺序应该为:(A

A. packageimportclass    B. importpackage class

C. class import package  D.packageclassimport

3)假设一个方法中会跑出异常(不是RuntimeException),并且需要被其他方法捕获,下面哪种方式的定义是正确的(B

A. throw Exception   B. throws Exception   C.new Exception

4)“abcd instanceof Object的结果是:(Binstanceof它的作用是测试它左边的对象是否是它右边的类的实例 返回boolean 类型

A. abcd  B.true   C.false   D.String

(5)Byte的数值范围为:(D

A. -127~128  B.0~256   C.-255~256   D.-128~127

(6)当一个类的对象需要具有比较大小功能时,该类需要实现的接口是:(B

A. List   B.Comparator   C.Comparable   D.Compiler

(7)下列哪些表达式返回结果为ture:B

A. hello!= hello   B. hello.equals(hello)

C. hello=hello    D. hello==hello

(8)一个类如何定义为一个线程类:(A

A.继承Thread   B.实现Throwable接口

C.实现MultiThread接口   D.实现SeriaLizable接口

9)编译运行下列程序的结果是:()

       Public class myClassC{

              Static int i

              Public static void main String argv[]{

                     System.out.println(i);

       }

}

A.出错:变量 I 未被初始化  B.null  C. 0  D.1  

 

(10) 下列代码输出结果为(C)

Int I = 1;

Switch (i) {

Case 0:

       System.out.println(zero);  Break;

Case 1:

System.out.println(one);

Case 2:

System.out.println(two);

Default:

System.out.println(default);

}

A.one   B. one,default  C.one,two,default D.default

3   多项选择题

<!--[if !supportLists]-->(1)    <!--[endif]-->下列哪些表达式会出现编译error 或者 warning问题 ABCD

<!--[if !supportLists]-->A.  <!--[endif]--> float f = 1.3 Bchar a = c“;  Cbyte b = 280;  D.boolean bu = null;   E. int I = 10;

2)些项的两个类定义具有“包含“关系 D

<!--[if !supportLists]-->A.  <!--[endif]-->public interface Person{}

public class Employee extends Person{}

B.public interface Shape{}

public interface Rectangle extends Shape{}

C.public interface Colorable{}

public class Shape implements Colorable{}

D.public class Species{}

public class Animal{private Sjpecies species;}

E.interface Component{}

class Container implements Component{private Component[ ] children;}

 

(3 下面哪一个正确地定义了一个数组:BCD

A. int scores = {0,0,0,0};

B.int scores[ ];

C.int[ ] scores;

D.int[ ] scores[ ];

 

(4关于Interface Abstract Class ,下面说法正确的是:ABC

A.Interface不能够包含代码的实现,而Abstract Class 可以

B.如果有函数实现和成员变量,就使用Abstract Class,否则 ,优先考虑Interface

C.一个类可以实现多个接口,但不能继承多个Abstract Class

D.Abstract Class 不能实现Interface

 

(5)下列关于LinkedList/ArrayList/Vector的说法当中,哪些说法是正确的 ACD

A. LinkedList使用双链表来实现,插入性能好,方法不是同步的

B.LinkedList 查找比ArrayList,适用于数据繁琐改变的场合

C.ArrayList插入的开销非常大,适用于大量的数据,改动很少,但是访问较多的场合

D.ArrayList使用数组来实现,索引查找性能好,方法是同步的

E.Vector使用数组来实现,索引查找性能好,方法都是同步的

 

4.分析解答题

<!--[if !supportLists]-->(1)   <!--[endif]-->回答以下类的相关问题

Public class ClassA{

public void methodOne(int i){

}

Public void methodTwo(int i){

}

public static void methodThree(int i){

}

Public static void methodFour(int i){

}

}

 

 

Public class ClassB extends ClassA{

  public static void methodOne(int i){

}//静态方法不能隐藏

public void methodTwo(int i){

} 隐藏

public void methodThree(int i){

}//静态方法不能覆盖

public static void methodFour(int i){

}覆盖

}

 

<!--[if !supportLists]-->A.      <!--[endif]-->哪个方法覆盖了父类方法?

<!--[if !supportLists]-->B.      <!--[endif]-->哪个方法隐藏了父类方法 ?

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值