分享
分销 收藏 举报 申诉 / 6
播放页_导航下方通栏广告

类型中兴面试测试题.doc

  • 上传人:天****
  • 文档编号:3052796
  • 上传时间:2024-06-14
  • 格式:DOC
  • 页数:6
  • 大小:29KB
  • 下载积分:6 金币
  • 播放页_非在线预览资源立即下载上方广告
    配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    中兴 面试 测试
    资源描述:
    面试测试题2 (一)、选择题(4′×10): (1)Which of the following range of short is correct? C A. -27 ~ 27-1 B. 0 ~ 216-1 C. -215 ~ 215-1 D. -231 ~ 231-1 (2)Which declarations of identifiers are legal? ABE A. $persons B. TwoUsers C. *point D. this E. _endline (3)Given the following code: C 1:public void modify() { 2: int i, j, k; 3: 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? C A. 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? A A. 010 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: public 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? D A. 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(); System.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? AD A. condition 1 B. condition 2 C. condition 3 D. finally (8)Given 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? C A. The value is 8 B. The value is 9 C. The value is 10 D. The value is 11 (9)Given the following code: public class Person{ static int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1];) } } Which statement is correct? C A. When compilation some error will occur. B. It is correct when compilation but will cause error when running. C. The output is zero. 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? AD A. s.equals(t); B. t.equals(c); C. s==t; D. t.equals(new String("hello")); E. t==c. 1、C 2、A、B、E 3、C 4、A 5、A、B 6、D 7、A、D 8、C 9、C 10、A、D (二)、填空题(4′×5): (1)、String str = new String (“Practical ”) ; str += “Java” ; 共产生几个对象:____5______。 (2)、递归函数sum(int a[],int n)的返回值是数组a[]的前n个元素之和 int sum(int a[],int n) { if (n>0) return __a[0]+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 { private 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 < 10; i++ ) v.add(new Int(i)); System.out.println("v: " + v); ArrayList v2 = (ArrayList)v.clone(); for(Iterator e = v2.iterator(); e.hasNext(); ) ((Int)e.next()).increment(); System.out.println("v: " + v); } } 上面这段代码输出什么 v: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ___v: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]______________________________________。 1、5个 2、a[n-1]+sum(a,n-1) 或 a[0]+sum(a+1,n-1) return 0 3、第二个(第一个丢失精度) 4、3 5、v: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] v: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] (1)、(15′)请编写程序打印下列图案: ********* ******* ***** *** * (2)、(25′)Java异常处理机制测试 继承Exception类编写一个自定义异常类MyException,在自定义异常类中加入一个方法getMyMessage(),此方法无参数,返回值为一个字符串,字符串内容为你的自定义异常信息:"你的姓名:" + Exception的getMessage()方法的返回值.格式如: (姓名:***Exception***)。 编写一个类ExceptionMaker,在里面定义一个方法throwException(),在这个方法中制造一种异常情况,抛出一个JDK自带的异常,捕捉这个异常,并在catch处理语句中抛出你的自定义异常MyException,抛出的自定义异常要求保留原异常的信息(getMessage()的返回值); 再编写一个类MyExceptionTestCase,测试你编写的前面两个类,调用第二个类中的抛出你自定义异常的方法throwException(),捕捉你的自定义异常,并输出你自定义的异常信息. 答案 (三)编程题 1、 public class Test01 { public static void main(String[] args) { int i, j, t, c; j = 1; t = 9; c = 5; while(c > 0){ for(i = 0; i <= j; i++){ System.out.print(" "); } j++; for(i = 0; i < t; i++){ System.out.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" + 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()); } } }
    展开阅读全文
    提示  咨信网温馨提示:
    1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
    2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
    3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
    4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
    5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
    6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

    开通VIP折扣优惠下载文档

    自信AI创作助手
    关于本文
    本文标题:中兴面试测试题.doc
    链接地址:https://www.zixin.com.cn/doc/3052796.html
    页脚通栏广告

    Copyright ©2010-2026   All Rights Reserved  宁波自信网络信息技术有限公司 版权所有   |  客服电话:0574-28810668    微信客服:咨信网客服    投诉电话:18658249818   

    违法和不良信息举报邮箱:help@zixin.com.cn    文档合作和网站合作邮箱:fuwu@zixin.com.cn    意见反馈和侵权处理邮箱:1219186828@qq.com   | 证照中心

    12321jubao.png12321网络举报中心 电话:010-12321  jubao.png中国互联网举报中心 电话:12377   gongan.png浙公网安备33021202000488号  icp.png浙ICP备2021020529号-1 浙B2-20240490   


    关注我们 :微信公众号  抖音  微博  LOFTER               

    自信网络  |  ZixinNetwork