JAVA期中试卷(英文)

别妄想泡我
502次浏览
2020年09月10日 07:33
最佳经验
本文由作者推荐

申论辅导-劳动竞赛方案



Subject
Object-Oriented Programming
Department
Institute of Information and Technology




Speciality Computer Science and Technology Grade 2012 Class
Name ID Teacher Director

Topic
Score
Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ




Total



You can answer the questions on the paper in Chinese. Please read
the problems carefully, and give the correct answer in proper place on
the paper.
Ⅰ. True or False(
1 point for each. Total 10 points.
)10%
1

2

3

4

5

6

7

8

9

10
1. 1.0 is a possible output from invoking (). [ ]
2. Every element in an array has the same type. [ ]
3. When invoking a constructor from a subclass, its superclass’s no-arg
constructor is always invoked. [ ]
4. You can only override accessible instance methods. [ ]
5. You can add any number of components to a panel or a frame. [ ]
6. You can derive a class from JButton, JPanel, or JFrame. [ ]
7. There are performance differences between the following two import
statements:import nPane; import .*; [ ]
8. A call to a method with a void return type is always a statement itself. [ ]
9.

An array is a primitive type value. [ ]
10.

The output of the following statement is 11 :n('1' + 1);
[ ]


Ⅱ.Fill in the blanks: (
1 points for each blank. Total 15 points.
) 15%

1. Declare an int constant SIZE with value 18 :

1



2. Which of the following statements are equivalent?
Which ones are correctly indented?

3. In loops the keyword only ends the current iteration;
The keyword immediately ends the innermost loop
4. Evaluate the following method calls:
(a) (25) (b) (2.5)
(c) (2.5) (d) (2.5)
5. Object-oriented programming techniques may include features such
as , , ,
and .
6. When an array of objects is created, its elements are assigned the default
value of .
7.

Three simple and frequently used layout managers are ,
GridLayout, and BorderLayout.

Ⅲ. Error Correction (Total 30 points.) 30%
1.
Identify
(标出)
and fix
(修改)
the errors in the following code: (
14%


1 public class Test {
2 public void main(String[] args) {
3 for (int i = 0; i < 10; i++);
4 sum += i;
5
6 if (i < j);
7 n(i)
8 else
9 n(j);

2



10
11 while (j < 10);
12 {
13 j++;
14 };
15
16 do {
17 j++;
18 } while (j < 10)
19 }
20 }





2.
Identify and fix the errors in the following classes: (
16%



1 class Circle {
2 private double radius;
3 public string color;
4 public Circle (double radius) {
5 radius = radius;
6 }
7
8 public setRadius(double r) {
9 radius=r;
10 }
11 public double getRadius() {
12 return radius;
13 }
14
15 public double getArea() {
16 return radius * radius *
17 }
18 }
19
20 class B extends Circle {
21 private double length;
22
23 B(double radius, double len) {
24 Circle(radius);
25 length = len;

3




26 }
27
28 ** Override getArea() *
29 public double getArea() {
30 return getArea() * length;
31 }
32 }


33 ** test Circle class **
34 public class testCircle (){
35 public static void main(String[] args) {
36 Circle c1=new Circle(1.0);
37 n(c1. getArea);
38 =2.0
39 =red;
40 n(ng());
41 }
42 }






Ⅳ. Programing Analysis (
5 point for 25 points.
) 25%
the result of the following programs: ( 10% )




4



2. Show the output of the following code: ( 5% )
import .*;
public class Test {
public static void main(String[] args) {
JButton jbtOK = new JButton(
n(ble());
JFrame frame = new JFrame();
n(ble());
}
}





3. Show the output of following program: ( 10% )





ming (
Total 20 points
) 20%
1.
Design the interface of ATM input keyboard. You can use the classes
below:

Layout
n

5






























6




2.

Design a class named Person and its two subclasses named Student and
Faculty and Staff subclasses of Employee. A person has a
name,address, phone number, and email address. A student has a class
status (freshman,sophomore, junior, or senior). Define the status as a
constant. An employee has an office, salary, and date hired. Define a class
named MyDate that contains the fields year, month, and day. A faculty member
has office hours and a rank. A staff member has a title. Override the toString
method in each class to display the class name and the person’s name.
Implement the classes. Write a test program that creates a Person, Student,
Employee, Faculty, and Staff, and invokes their toString() methods.
































7












































8

江西省奉新县-陈涉世家读后感


杨红樱的书-难忘时刻


2020中考录取分数线-七夕情人节歌曲


军训作文500字-五一活动方案


傅琰东-社交口才


招商银行武汉分行-斯琴高美


环境管理体系认证-江门人事网


材料类-关于爱情的名人名言