2016届 阿里巴巴校招研发工程师C/C++笔试题--2015.08.23

选择题牛客网地址题目1:http://www.nowcoder.com/test/255234/summary

题目2:http://www.nowcoder.com/test/262758/summary

题目3:http://www.nowcoder.com/test/280885/summary

题目4:http://www.nowcoder.com/test/315791/summary

部分选择题如下:

1、如果下列的公式成立:78+78=123,则采用的是_______进制表示的。

A.       11

B.       12

C.       13

D.       14

E.        15

F.        以上都不对

解答1:列方程:78+78=123 =》7x+8 + 7x+8=x^2+2x+3 =》 x=13

解答2:直接看个位:8+8=16,16-x=3 =》 x=13

 

2.、下列 java 程序输出结果为______。

 

 

int i=0;

Integer j = new Integer(0);

System.out.println(i==j);

System.out.println(j.equals(i));

A.       true,false

B.       true,true

C.       false,true

D.       false,false

E.        对于不同的环境结果不同

F.        程序无法执行

解答:int类型与Integer进行比较,Integer会自动拆箱成Int类型再比较,所以为true。

 

3、下列java程序的输出结果为____。

public class Example{

    String str=new String("hello");

    char[]ch={'a','b'};

    public static void main(String args[]){

        Example ex=new Example();

        ex.change(ex.str,ex.ch);

        System.out.print(ex.str+" and ");

        Sytem.out.print(ex.ch);

    }

    public void change(String str,char ch[]){

        str="test ok";

        ch[0]='c';

    }

}

A.       hello and ab

B.       hello and cb

C.       hello and a

D.       test ok and ab

E.        test ok and cb

F.        test ok and c

解答:change第一个函数传递的不是string的引用,所以不会改变值,第二个参数会退化为指针,所以改变传入参数的值,第一个string不变为hello,第二个改变第一个字符,为cb,所以答案为B

 

4、有关下述Java代码描述正确的选项是____。

public class TestClass {

   private static void testMethod(){

        System.out.println("testMethod");

   }

   public static void main(String[] args) {

        ((TestClass)null).testMethod();

   }

}

A.       编译不通过

B.       编译通过,运行异常,报NullPoi

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值