大学JAVA语言程序设计期末考试试题及答案
Final revision by standardization team on December 10, 2020.
《JAVA语言程序设计》期末考试试题及答案3(应考必备
题库)
一、单项选择题
1、如下哪个是Java中的标识符()
A、public B、super
C、3number C、3number
D、width D、#number
2、如下哪个是Java中的标识符( )
A、fieldname B、super A、s += \C、int len = ; A、name
3、已知如下定义:String s = \下面哪个语句不是合法的( )
B、s = s + 100; D、String t = s + “abc”; C、false
D、good
4、如下哪个是Java中有效的关键字()
B、hello
5、下面的代码段执行之后count的值是什么( )
int count = 1;
for (int i = 1; i <= 5; i++) { }
count += i;
、5 B、1
C、15
D、16
D、static D、static
6、定义一个类,必须使用的关键字是( )
A、public A、public 用的语句是( )
A、(b);
B、(b,\
C、(b,\ D、(p,\ 9、声明并创建一个按钮对象b,应该使用的语句是( )
A、Button b=new Button(); B、button b=new button(); C、Button b=new b(); D、(“确定”); 10、Frame对象默认的布局管理器是( )
A、FlowLayout C、CardLayout A、import .*; C、import .*;
B、BorderLayout D、null
B、class B、class
C、interface C、interface
7、定义一个接口必须使用的关键字是( )
8、如果容器组件p的布局是BorderLayout,则在p的下边中添加一个按钮b,应该使
11、下列哪一个import命令可以使我们在程序中创建输入/输出流对象()
B、import .*; D、import .*;
12、下面哪一个import命令可以为我们提供编写网络应用程序的类()
A、import .*; C、import .*;
B、import .*; D、import .*;
B、FileOutputStream
13、如果需要从文件中读取数据,则可以在程序中创建哪一个类的对象()
A、FileInputStream C、DataOutputStream
D、FileWriter
二、填空题
1、如果将类MyClass声明为public,它的文件名称必须是()才能正常编译。 2、Java程序中的单行注释符是( ; )。
8、当声明一个数组int arr[] = new int[5]; 时,这代表这个数组所保存的变量类型是(int),数组名是(arr),数组的大小为(5),数组元素下标的使用范围是(0到4)。
9、假设x=13,y=4,则表达式x%y != 0的值是(true),其数据类型是(boolean)。
10、异常处理是由(try)、(catch)和finally块三个关键所组成的程序块。 11、以下程序段的输出结果是(三角形)
int x = 5, y = 6, z = 4;
if (x + y > z && x + z > y && z + y > x) else
\不是三角形\); \三角形\);
12、下面程序段的执行结果是(6 5 4 3 2)
int a[] = { 2, 3, 4, 5, 6 }; for (int i = - 1; i >= 0; i--)
+ \);
三、程序阅读题
1、以下程序的输出结果为_ Peter is 17 years old!___。
public class Person { }
String name; int age;
public Person(String name, int age) { }
public static void main(String[] args) { }
Person c = new Person(\, 17); + \ + + \); = name; = age;
2、以下程序的输出结果为__课程号:101 课程名:ASP 学分:3___。
public class Course {
大学JAVA语言程序设计期末考试试题及答案



