2018年12月计算机二级Java考试冲刺题及答案(3)

    作者:课课家教育更新于: 2019-12-12 15:28:53

     1.下列选项成员变量声明正确的是()。

      A.publicprotectedfinalinti;

      B.abstractclassFl{…}

      C.privatedoubleheight;

      D.doubleweight()

      2.下面程序段的输出结果是()。

      classTest{

      publics,taticvoidmain(Stringargs[]){

      MyThreadt=newMyThread();

      t.displayOutput("thasbeencreateD");

      t.start();

      }

      }

      ClassMyThreadextendsThread{

      publicvoiddisplayOutput(Strings){

      System.out.println(s);

      }

      publicvoidrun(){

      displayOutput("tisrunning.");

      }

      }

      A.thasbeencreated.

      B.thasbeencreated.tisrunning.

      C.tisrunning.

      D.编译出错

      3.执行下列程序时,会产生什么异常()。

      publicclassTest{

      publicstaticvoidmain(Stringargs[]){

      intd=101;

      intb=220:

      longa=321;

      System.OUt.println((a-b)/(a-b-d));

      }

      }

      A.ArraylndexOutOfBoundsException

      B.NumberFormatException

      C.ArithmeticException

      D.EOFExeeption

      4.下面程序段的输出结果为()。

      publicclassTest

      {

      publicstaticvoidmain(Stringargs[])

      {

      booleana,b,C;

      a=(3<5):

      b=(a==true);

      System.out.println("a="+a+"b="+b);

      c=(b==false);

      System.out.println("b="+b+"c="+c);

      }

      }

      A.a=trueb=falseB.fl=trueb=false

      b=truec=trueb=truec=false

      C.a=trueb=trueD.a=falseb=false

      b=truec=falseb=truec=false

      5.下面程序段的输出结果是()。

      publicclassTest{

      publicstaticvoidmain(Stringargs[]){

      inta,b;

      for(a=1,b=1;a<=100;a++){

      if(b>=10)break;

      if(b%2==1){

      b+=2:

      continue;

      }

      }

      System.OUt.println(a);

      }

      }

      A.5B.6

      C.7D.101

      6.栈中允许进行插入和删除的一端称为()。

      A.栈顶B.栈底

      C.栈端D.栈尾

      7.下面程序段的输出结果是()。

      publicclassTest{

      publicstaticvoidmain(Stringargs[]){

      inti=1:

      switch(i){

      case0:

      System.OUt.println("0");

      break;

      casel:

      System.out.println("1");

      case2:

      System.OUt.println("2");

      break;

      default:

      System.out.println("default");

      }

      }

      }

      A.01

      B.12

      C.10

      D.21

      8.Frame默认的布局管理器是()。

      A.FlowLayout

      B.BorderLayout

      C.GridLayout

      D.UpLayout

      9.在java语言中,ObjectOutputStream是指()。

      A.字节流

      B.字符流

      C.对象输出流

      D.数据流

      10.请阅读下列程序代码,然后将程序的执行结果补充完整。横线处应填写的内容是()。

      程序代码:

      publicclassthrowsExeeption{

      staticvoidProc(intsel)

      throwsArithmeticException,ArrayIndexOutOf

      BoundsException{

      System.out.println("InSituation"+sel);

      if(sel==0){

      System.OUt.println("noExceptioncaught");

      return;

      }

      elseif(sel==l){

      intiArray[]=newint[4];

      iArray[1]=3;

      }

      }

      publicstaticvoidmain(Stringargs[]){

      try{

      proe(O);

      Proc(1);

      }

      catch(ArrayIndexOutOfBoundsExceptione){

      System.out.println("Catch"+e);

      }

      finally{

      System.out.println("inProcfinally"):

      }

      }

      }

      执行结果:

      InSituation0

      noExceptioncaught

      inProcfinally

      A.InSituationl

      B.InSituation

      C.withCatch

      D.intiArrayl

    课课家教育,拥有十年计算机等级考试培训经验,课课家教育一直坚持自主研发,将丰富的计算机等级考试培训经验有效融入教程研发过程,自成体系的计算机等级考试视频教程计算机等级考试培训教材计算机等级考试在线题库,使考生的学习更具系统性,辅导更具针对性。想要报考2019年计算机等级考试的考生现在就可以开始备考了,报名课课家计算机等级各科目考试赠送:辅导教材、历年真题、考前冲剌资料、在线模拟测试题库、老师专属答疑指导等,保障学员顺利通过考试。

      >>>>>>点击进入计算机等级考试专题

课课家教育

未登录