选择题牛客网地址题目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