(图片大小可自由调整)
2025年计算机考试-Java认证考试近5年真题集锦(频考类试题)带答案
第I卷
一.参考题库(共80题)
1.What?is?the?result?()
A、2
B、3
C、1,2
D、2,3
E、1,2,3
2.下面哪种情况会导致持久区jvm堆内存溢出()。
A、循环上万次的字符串处理
B、在一段代码内申请上百M甚至上G的内存
C、使用CGLib技术直接操作字节码运行,生成大量的动态类
D、不断创建对象
3.输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。
4.下列有关多态的叙述正确的是哪项()?????
A、父类的引用指向子类的实例是一种多态
B、子类的引用指向子类的实例是一种多态
C、接口的引用指向实现该接口类的实例是一种多态
D、抽象类的引用指向抽象类的实例是一种多态
5.package?foo;? import?java.util.Vector; private?class?MyVector?extends?Vector?{? int?i?=?1;? public?MyVector()?{? i?=?2; } }? public?class?MyNewVector?extends?MyVector?{? public?MyNewVector()?{? i?=?4;? }? public?static?void?main(String?args[])?{? MyVector?v?=?new?MyNewVector();? }? }? What?is?the?result?()
A、?Compilation?succeeds.
B、?Compilation?fails?because?of?an?error?at?line?5.
C、?Compilation?fails?because?of?an?error?at?line?6.
D、?Compilation?fails?because?of?an?error?at?line?14.
E、?Compilation?fails?because?of?an?error?at?line?17.
6.What?is?the?resultasfollows?()
A、5,6
B、5,5
C、6,5
D、6,6
7.举例说明类和类之间的关系。
8.猴子摘桃问题猴子第1天摘下若干桃子,当即吃掉一半,又多吃一个,第二天将剩余的部分吃掉一半还多一个;以此类推,到第10天只剩余1个。问第1天共摘了多少桃子
9.3.?string?foo?=?“ABCDE”;? 4.?foo.substring(3);? 5.?foo.concat(“XYZ”);? 6.???? Type?the?value?of?foo?at?line?6.()
10.What?is?the?result?when?the?programmer?attempts?to?compile?the?code?and?run?it?with?the?command?java?Converter?12?()
A、It?is?true?that?j==i.
B、It?is?false?that?j==i.
C、An?exception?is?thrown?at?runtime.
D、Compilation?fails?because?of?an?error?in?line?13.
11.如下代码,执行test()函数后,屏幕打印结果为()。
A、A
B、B
C、C
D、D
12.public?class?Test?{?? public?static?void?main?(String?args)?{?? class?Foo?{?? public?int?i?=?3;? }?? Object?o?=?(Object)?new?Foo();?? Foo?foo?=?(Foo)o;?? System.out.printIn(foo.?i);? }?? }?? What?is?the?result?()??
A、?Compilation?will?fail.
B、?Compilat