全部题库 / Java / 试题详情
单选题 Java
2014-03-15

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

A.37
B.31
C.33
D.35

参考答案

C

答案解析

本题是对for循环语句和数组的综合考查。题中共定义了两个数组:a[]和p[],共用了3次for循环;第1个for语句对数组a[i]赋值;第2个for语句对数组p[i]赋值;第3个for语句计算k的值。3次循环分别得到:5,15和33。正确答案为选项C。

你可能感兴趣的试题

A.ActionListener
B.FocusListener
C.MouseMotionListener
D.WindowListener
A.int read(byte[])
B.void flush(  )
C.void close(  )
D.int available(  )