收藏 分销(赏)

2023年中兴面试测试题.doc

上传人:天**** 文档编号:4453773 上传时间:2024-09-23 格式:DOC 页数:12 大小:29.54KB
下载 相关 举报
2023年中兴面试测试题.doc_第1页
第1页 / 共12页
2023年中兴面试测试题.doc_第2页
第2页 / 共12页
2023年中兴面试测试题.doc_第3页
第3页 / 共12页
2023年中兴面试测试题.doc_第4页
第4页 / 共12页
2023年中兴面试测试题.doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

1、面试测试题2(一)、选择题(410):(1)Which of the following range of short is correct? CA. -27 27-1 B. 0 216-1 C. -215 215-1 D. -231 231-1 (2)Which declarations of identifiers are legal? ABEA. $persons B. TwoUsers C. *point D. this E. _endline (3)Given the following code: C1:public void modify() 2: int i, j, k; 3:

2、 i = 100; 4: while ( i 0 ) 5: j = i * 2; 6: System.out.println ( The value of j is + j ); 7: k = k + 1; 8: i-; 9: 10: Which line might cause an error during compilation? CA. line 4 B. line 6 C. line 7 D. line 8 (4)Which of the following answer is correct to express the value 8 in octal number? AA. 0

3、10 B. 0x10 C. 08 D. 0x8 (5)Which are not Java keywords?AB A. TRUE B. sizeof C. const D. super E. void (6)Given the following code:1:class Person 2: public void printValue(int i, int j) /. 3: public void printValue(int i)/. 4: 5:public class Teacher extends Person 6: public void printValue() /. 7: pu

4、blic void printValue(int i) /. 8: public static void main(String args) 9: Person t = new Teacher(); 10: t.printValue(10); 11: 12:Which method will the statement on line 10 call? DA. on line 2 B. on line 3 C. on line 6 D. on line 7 (7)Given the following code:public void test() try oneMethod(); Syste

5、m.out.println(condition 1); catch (ArrayIndexOutOfBoundsException e) System.out.println(condition 2); catch(Exception e) System.out.println(condition 3); finally System.out.println(finally); Which will display if oneMethod run normally? ADA. condition 1 B. condition 2 C. condition 3 D. finally(8)Giv

6、en the following code: public class Test void printValue(int m) do System.out.println(The value is+m); while( -m 10 ); public static void main(String arg) int i=10; Test t= new Test(); t.printValue(i); Which will be output? CA. The value is 8 B. The value is 9 C. The value is 10 D. The value is 11 (

7、9)Given the following code: public class Person static int arr = new int10; public static void main(String a) System.out.println(arr1;) Which statement is correct? CA. When compilation some error will occur. B. It is correct when compilation but will cause error when running. C. The output is zero.

8、D. The output is null. (10)Given the following code:String s = hello; String t = hello; char c = h,e,l,l,o ; Which return true? ADA. s.equals(t); B. t.equals(c);C. s=t;D. t.equals(new String(hello); E. t=c. 1、C2、A、B、E3、C4、A5、A、B6、D7、A、D8、C9、C10、A、D(二)、填空题(45): (1)、String str = new String (“Practical

9、 ”) ;str += “Java” ;共产生几种对象:_5_。(2)、递归函数sum(int a,int n)旳返回值是数组a旳前n个元素之和int sum(int a,int n) if (n0) return _a0+sum(a+1,n-1)_;else _return 0;(3)、short s1 = 1; s1 = s1 + 1和 short s1 = 1; s1 += 1; 那个可以编译通过,为何_第二个 第一种 丢失精度_。(4)、设int x=1,y=2,z=3,则体现式 y+=z-/+x旳值是_3_。(5)、import java.util.*;class Int priva

10、te int i; public Int(int ii) i = ii; public void increment() i+; public String toString() return Integer.toString(i); public class test public static void main(String args) ArrayList v = new ArrayList(); for(int i = 0; i 0) for(i = 0; i = j; i+) System.out.print( ); j+; for(i = 0; i t; i+) System.ou

11、t.print(*); t -= 2; System.out.println(); c-; 2、/* * 自定义旳异常类 */class MyException extends Exception private String str; /* * 抛出异常 *return 抛出异常串 */ public String getMyMessage() return str; /* * 构造自定义异常 *param 发生旳异常 */ public MyException(Exception e) Exception excep = new Exception(e); str = zhanggenbo

12、 + excep.getMessage(); /* * 自定义旳异常类 */class ExceptionMaker /* * 扑获异常 */ public void throwException() throws ArithmeticException, MyException try int i = 3 / 0; catch (ArithmeticException e) System.out.println(e.getMessage(); throw new MyException(e); /* * 测试异常类文件 *author 张根波 */public class MyExceptionTestCase /* * 测试异常 *param arg 入口参数 */ public static void main(String arg) ExceptionMaker em = new ExceptionMaker(); try em.throwException(); catch (MyException e) System.out.println(e.getMyMessage();

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 考试专区 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服