311020040面向对象程序设计导论_双语_a闭

上传人:xzh****18 文档编号:45729514 上传时间:2018-06-18 格式:PDF 页数:7 大小:232.88KB
返回 下载 相关 举报
311020040面向对象程序设计导论_双语_a闭_第1页
第1页 / 共7页
311020040面向对象程序设计导论_双语_a闭_第2页
第2页 / 共7页
311020040面向对象程序设计导论_双语_a闭_第3页
第3页 / 共7页
311020040面向对象程序设计导论_双语_a闭_第4页
第4页 / 共7页
311020040面向对象程序设计导论_双语_a闭_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《311020040面向对象程序设计导论_双语_a闭》由会员分享,可在线阅读,更多相关《311020040面向对象程序设计导论_双语_a闭(7页珍藏版)》请在金锄头文库上搜索。

1、 311020040 面向对象程序设计导论面向对象程序设计导论(双语双语) (A 闭闭) 2012-2013-1 一、单项选择题(本大题共一、单项选择题(本大题共3 30 0小题,每小题小题,每小题2 2分,共分,共6 60 0分)分) 提示:在每小题列出的四个备选项中只有一个是符合题目要求的,请将其代码填写在下表中。错选、多选或未选均无分。 1、 Which method must exist in every Java application? A. main B. paint C. begin D. init 2、 Which of the following statements is

2、 (are) true about the use of an asterisk (*) in a Java import statement? I. It does not incur run-time overhead. II. It can be used to import multiple packages with a single statement. III. It can be used to import multiple classes with a single statement. A. I and III only B. III only C. I only D.

3、I, II, and III 3、 A difference between the methods print and println of the class java.io.PrintWriter is that A. print inserts a new line at the beginning of its output, but println does not B. println appends a new line to the end of its output, but print does not C. println inserts a new line at t

4、he beginning of its output, but print does not D. print appends a new line to the end of its output, but println does not 4、 Suppose that the integer array list has been declared and initialized as follows: private int list = 10, 20, 30, 40, 50 ; public void mystery(int array) int tmp = arrayarray.l

5、ength - 1; for (int i = 1; i array.length; i+) arrayi = arrayi - 1; array0 = tmp; Given this array, what is the effect of calling the method mystery(list) A. 10, 20, 30, 40, 50 B. 30, 40, 50, 10, 20 C. 20, 30, 40, 50, 10 D. 50, 10, 20, 30, 40 5、 According to Javadoc convention, the first sentence of

6、 each Javadoc comment should be A. an version tag B. the order of lines is not important C. an author tag D. a summary sentence of the declared class 6、 Which of the following statements about constructors in Java is true. A. A class must define at least one constructor B. A class can define more th

7、an one constructor C. A constructor must be defined as public D. A constructor must be defined as static 311020040 面向对象程序设计导论面向对象程序设计导论(双语双语) (A 闭闭) 2012-2013-1 7、 A collection typically models a _ relationship. A. one-to-one B. zero-to-one C. many-to-many D. one-to-many 8、 Consider the following UM

8、L class diagram. ClassAClassCClassB111.*According to the diagram, which of the following statements is true? A. ClassA and ClassB each contain at least one reference to an instance of ClassC. B. ClassB and ClassC are both subclasses of ClassA. C. ClassA is composed of one instance of ClassB and one

9、or more instances of ClassC. D. ClassB has a one-to-one association with ClassA and a one-to-many association with ClassC. 9、If the method int sum(int a, int b) is defined in a Java class C, which of the following methods cannot coexist as a different method in class C? A. int sum(float a, int b) B.

10、 int sum(int x, float y) C. int sum(int x, int y) D. float sum(int x, float y) 10、 Regarding the following declaration, what is the index of the element containing 45? int numbers = -1, 45, 6, 132; A. 1 B. 2 C. 45 D. 0 11、Consider the following Java program segment. import java.io.*; public class Te

11、st public Test( ) System.out.println(“default“); public Test( int i ) System.out.println(“non-default“); public static void main(String args) Test t = new Test(2); Which of the following will be output during execution of the program segment? 311020040 面向对象程序设计导论面向对象程序设计导论(双语双语) (A 闭闭) 2012-2013-1 A

12、. The line of text “non-default“ B. The line of text “default“ C. The line of text “non-default“ followed by the line of text “default“ D. The line of text “default“ followed by the line of text “non-default“ 12、If a class contains a constructor, that constructor will be invoked A. each time an obje

13、ct of that class is instantiated B. once the first time an object of that class is instantiated C. each time an object of that class goes out of scope D. once at the beginning of any program that uses that class 13、Which is the Java keyword used to denote a class method? A. class B. static C. privat

14、e D. final 14、Consider the Java program below. public class Arr public static void main(String args) int a = 1, 2, 3; System.out.println(a1); System.out.println(a3); Which of the following is true about the result of executing the program? A. The number 2 is printed and a run-time exception terminat

15、es execution. B. The number 2 is printed and there is no abnormal termination. C. The number 1 is printed and there is no abnormal termination. D. The number 3 is printed and a run-time exception terminates execution. 15、Given the following code, how many tokens will be output? StringTokenizer st = new StringTokenizer(“this is a test“, ”s”); while (st.hasMoreTokens() stdOut.println(st.nextToken() ); A. 1 B. 0 C. 3 D. 4 16、An object that contains methods that traverse a vector linearly from start to

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号