阅读下面的程序段,回答以下问题。
if (x < 5 ) System.out.print(" one ");
else {
if (y < 5 ) System.out.print(" two ");
else System.out.println(" three ");
}
问题:1)若执行前x=6,y=8,该程序段输出是什么?2)若执行前x=1,y=8,该程序段输出是什么?
第2题
阅读下面的程序,填写程序中缺少的部分,并把程序的输出结果写出来;
classTest{
staticvoidShowArrayInfo(int[]student){
for(inti=0;i
Console.Write(student[i]++);
Console.Write(“”);
}
}
staticvoidMain(){
int[]student=newint[]{1,2,3,4,5};
ShowArrayInfo(student);
Console.Write(“/n”);
ShowArrayInfo(student);
}
}
输出结果:
第5题
A.8
B.2
C.6
D.4
第7题
A.编译时报错,程序无法运行
B.编译无错,运行正常,输出 3 , 5
C.编译无错,运行时报错
D.编译时报警告错,但运行正常,输出 3 , 5
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!