出国留学网

目录

2018年3月计算机二级考试JAVA强化习题(1)

【 liuxue86.com - 计算机二级 】

  2018年3月计算机等级考试开始啦,小编在这里为考生们整理了2018年3月计算机二级考试JAVA强化习题,希望有所帮助,想了解更多消息,请关注出国留学网的及时更新哦。

  2018年3月计算机二级考试JAVA强化习题(1)

  1.下列程序的输出结果是()。

  publicclassArrayTest

  {

  publicstaticvoidmain(Stringargs[])

  {

  int[]intArray=newint[3]

  for(inti=0;i<3;i++)

  {

  intArray[i]=i+2:

  system.out.println("lntArray["+i+"]¨=

  intArray[i]);

  }

  System.out.println("----------");

  intarrlen=4:

  IntArray=newint[arrLen];

  For(intj=intArray.length;j>=0;j--)

  {

  intArray[j]=j*3;

  system.out.println("hello"+intArray[j]);

  }

  }

  }

  A.编译未通过

  B.编译通过,但运行错误

  C.可以运行,但有错误

  D.以上都不对

  2.下列程序的运行结果是()。

  Publicclasssun

  {

  Publicstaticvoidmain(Stringargs[])

  {

  intx=4,y=0;

  if(Math.pow(X,2)==16)

  y—x;

  if(Math.pow(X,2)<15)

  y—l/x;

  if(Math.pow(X,2)>15)

  y=(int)Math.pow(X,2)+1;

  system.out.println(y);

  }

  }

  A.4

  B.17

  C.18

  D.0.25

  3.自定义的异常类可从()类继承。

  A.Error

  B.AWTError

  C.VirtualMachineError

  D.Exception及其子集

  4.t为int类型,进入下面的循环之前,t的值为0。则下列说法中正确的是()。while(t=1){…}

  A.循环控制表达式的值为0

  B.循环控制表达式的值为1

  C.循环控制表达式不合法

  D.以上说法都不对

  5.下面for循环语句的执行结果是()。

  for(intj=10;j>3;j--)

  if(j1=O)

  j--;

  --j;

  --j;

  System.OUt.println(j);

  }

  A.63

  B.74

  C.62

  D.73

  6.关于Applet执行的操作,下面说法正确的是()。

  A.在运行时调用其他程序

  B.可以进行文件读/写操作

  C.不能装载动态连接库和调用任何本地方法

  D.试图打开一个socket进行网络通信,但是所连接的主机并不是提供Applet的主机

  7.下列关于Applet生命周期的说法,正确的是()。

  A.voidinit()在Applet下载前调用

  B.voidstart()只在初始化之后调用

  C.voidstop()在关闭浏览器时调用

  D.stop()总在voiddestroy()之前被调用

  8.对于下面语句的说法,不正确的是()。ThreadthrObj=newThread():

  A.系统没有为该线程对象分配资源

  B.只能启动或者终止

  C.创建了一个空的线程对象

  D.可以调用其他方法

  9.在Java中,线程是()。

  A.分时的

  B.抢占式的

  C.非抢占式的

  D.非分时的

  10.下列关于线程和进程的说法正确的是()。

  A.进程结构的所有成分都在用户空间内

  B.用户程序能够直接访问进程涉及的数据

  C.线程是内核级的实体

  D.线程结构驻留在用户空间中

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

  A.publicprotectedfinalinti;

  B.abstractclassFl{…}

  C.privatedoubleheight;

  D.doubleweight()

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

  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.编译出错

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

  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

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

  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

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

  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

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

  A.栈顶B.栈底

  C.栈端D.栈尾

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

  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

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

  A.FlowLayout

  B.BorderLayout

  C.GridLayout

  D.UpLayout

  19.在Java语言中,ObjectOutputStream是指()。

  A.字节流

  B.字符流

  C.对象输出流

  D.数据流

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

  程序代码:

  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

  想了解更多计算机二级网的资讯,请访问: 北京计算机二级

本文来源:https://jsj.liuxue86.com/a/3638405.html
延伸阅读
    想必要考试的考生,对快捷键还是有敏感的,快捷键不仅使你考试能做题快一些,在平时设计网站时也是有很大的帮助的,在这里预祝即将考试的考生
2019-01-02
    我们都想知道在学习计算机语言中的C语言,最重要的就是字符串了,小编整理了关于C语言的一些知识点,对你的计算机考试会有帮助的,想了解更
2019-01-02
    滚动字幕会让很多人感到兴奋,特别是第一次使用滚动字幕时,会爱不释手。现在做一个详细的方案,让你更全面地了解一下。小编整理了一些滚动字
2019-01-02
你准备好计算机等级考试了么?小编为大家提供“2018年12月计算机二级Java冲刺题及答案3”供广大考生参考,希望帮到您!更多计算机等级考试的资讯请关注我们网站的更新哦!2018年
2018-11-28
计算机等级考试栏目小编精心为您收集整理了《2018年12月计算机二级Java冲刺题及答案1》,希望给您带来帮助!更多精彩内容尽在本站,请持续关注。祝您考试顺利哦!2018年12月计
2018-11-28
本网站计算机考试栏目小编为考生们整理了“2018年12月计算机二级Java冲刺题及答案2”,希望有所帮助,更多计算机等级考试信息请关注本网站的及时更新哦。祝同学们金榜题名!2018
2018-11-28
三层模式是体系结构模式,MVC是设计模式,考生们应该常见吧,小编为你整理了一些关于JavaBean的资料,供程序员参考,希望能对你有所帮助!计算机二级考试-Web前端程序设计(Ja
2019-01-02
漂亮的Flash动画人人喜欢,不过制作起来的确有一些技术难度。你知道吗,Dreamweaver作为一个网页制作工具,还可以创建好玩的Flash相册。小编整理了一些Flash相册的资
2019-01-02