2020年计算机二级JAVA考试每日一练(5月26日)
2020年计算机二级JAVA考试每日一练(5月26日)
1.下列选项成员变量声明正确的是( )。
A.public protected final int i;
B.abstract class Fl{…}
C.private double height;
D.double weight()
答案:C
2.下面程序段的输出结果是( )。
class Test{
public s,tatic void main(String args[]){
MyThread t=new MyThread();
t.displayOutput("t has been createD");
t.start();
}
}
Class MyThread extends Thread{
public void displayOutput(String s){
System.out.println(s);
}
public void run(){
displayOutput("t is running.");
}
}
A.t has been created.
B.t has been created. t is running.
C.t is running.
D.编译出错
答案:B
3.执行下列程序时,会产生什么异常( )。
public class Test{
public static void main(String args[]){
int d=101;
int b=220:
long a=321;
System.OUt.println((a-b)/(a-b-d));
}
}
A.ArraylndexOutOfBoundsException
B.NumberFormatException
C.ArithmeticException
D.EOFExeeption
答案:C
4.下面程序段的输出结果为( )。
public class Test
{
public static void main(String args[])
{
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=true b=false
b=true c=true
B.fl=true b=false
b=true c=false
C.a=true b=true
b=true c=false
D.a=false b=false
b=true c=false
答案:C
5.下面程序段的输出结果是( )。
public class Test{
public static void main(String args[]){
int a,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.5
B.6
C.7
D.101
答案:B
更多2020年计算机二级JAVA考试每日一练试题,请继续关注环球网校计算机二级频道。需要及时了解考试动态的小伙伴可“ 免费预约短信提醒”届时环球网校会及时为大家推送2020年计算机二级考试相关信息提醒。环球网校友情提示:对于想要参加计算机二级考试的小伙伴们,环球网校特地为您准备了计算机二级考试资料,如有需要请点击文章下方“免费下载>>>计算机二级考试资料”下载学习。