软件学院_面向对象程序设计_2008-2009(2)期末B卷

上传人:飞****9 文档编号:130675520 上传时间:2020-04-30 格式:DOC 页数:12 大小:130.51KB
返回 下载 相关 举报
软件学院_面向对象程序设计_2008-2009(2)期末B卷_第1页
第1页 / 共12页
软件学院_面向对象程序设计_2008-2009(2)期末B卷_第2页
第2页 / 共12页
软件学院_面向对象程序设计_2008-2009(2)期末B卷_第3页
第3页 / 共12页
软件学院_面向对象程序设计_2008-2009(2)期末B卷_第4页
第4页 / 共12页
软件学院_面向对象程序设计_2008-2009(2)期末B卷_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《软件学院_面向对象程序设计_2008-2009(2)期末B卷》由会员分享,可在线阅读,更多相关《软件学院_面向对象程序设计_2008-2009(2)期末B卷(12页珍藏版)》请在金锄头文库上搜索。

1、一、 选择题(30分)说明:每题2分,只有1个正确答案,请将正确答案填写在下面表格中。题号123456789101112131415答案1 Which of the following statements is correct about Java packages?A.A package may contain unlimited number of nested sub-packages.B.A package is a collection of related Java source program.C.Using the import statement can include a

2、ll the classes into the current program from a specified package and its sub-packages.D.If there is no package statement used, the current class will not be in any package.2 Which one is the wrong statement about Java constructors?A.The name of a constructor must be the same as its classs name.B.A c

3、onstructor has no return value and can not be modified by void.C.A constructor of the parent class can not be inherited by its sub-classes.D.All constructors must be modified by public.3 Giving the code bellow:class Test private int m; public static void fun() /* some code. */ How to make the member

4、 variable m accessible for method fun()?A.change private int m to protected int mB.change private int m to public int mC.change private int m to static int mD.change private int m to int m4 Which of the following functions is an overloading function of public void example().?A.public void example().

5、B.public int example().C.public void example2().D.public int example(int m, float f).5 In Java, a class may have many different methods with the same name. The number, type, sequences of arguments in these methods are different, and the return value can be different as well. What do we call this fea

6、ture in terms of object-oriented programming?A.HidingB.OverridingC.OverloadingD.This feature is not supported in Java6 How to execute the following program?public class Test public static void main(String args) System.out.println(args0); A.java Test.classB.java TestC.java Test aStringD.javac Test7 I

7、f a container has been resized, which of the following layout manager did not change the internal components size?A.CardLayoutB.FlowLayoutC.BorderLayoutD.GridLayout8 Which is the right statement about exception handling?A.In java, all exceptions are necessary to be caught and handled.B.The “catch” s

8、tatement catches exception by type-matching.C.In the “try-catch-finally” structure, the program will exit after exception handling.D.Exception is a kind of errors, and it should be absolutely avoided in programs.9 The following statements are about type-casting, which one is correct?A.A reference va

9、riable of a class can only be assigned to an object of its first level sub-classes of this class.B.An object can not be casted to the type of another class which has no inheritance relationship with the objects original class.C.A child classs reference variable can be assigned to an object of its pa

10、rent class.D.There is only explicit casting, but no implicit casting.10 Both class Teacher and Student are the sub-classes of Person.Person p; Teacher t; Student s; / assume p, t and s are not nullif(t instanceof Person) s = (Student)t; Which statement about the last line of expression is correct?A.

11、A new Student object will be created.B.The type-casting is correct.C.The expression is incorrect.D.There is no syntax error but will generate runtime error.11 According to the code below, which statement is correct?public class Test static Object o; public static void main(String args) System.out.pr

12、intln(o); A.Generates compile error.B.Compiles OK, but has runtime errors.C.Outputs zero.D.Outputs “null”.12 According to the code below, select the statement which is false.String s = Hello;String s1 = new String(Hello);String s2 = s1.intern();String s3 = Hello;A.s1 = sB.s2 = sC.s = s3D.s2 = s313 T

13、he array definition code is given below, which statement is correct?String s = new String10;A.The definition of array s is illegal in syntax.B.s is a 1010 two-dimensional array.C.All elements in s are .D.s is an array of ten arrays.14 Which is the correct output according to the program given bellow

14、?public static void main(String args) Scanner scanner = new Scanner(this is one that is two); scanner.useDelimiter( is); / there is a space before is while(scanner.hasNext() System.out.print(scanner.next(); A.this one that twoB.th one that twoC.thone that twoD.this is one that is two15 The file “empty.txt” does not exist before, what its content will be after executing the following code.public static void main(String args) throws FileNotFoundException PrintWriter pr = new PrintWriter(new File(empty.txt); pr.print(onettwo); pr.append(n1t2);

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

当前位置:首页 > 学术论文 > 管理论文

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