




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、。装。订。线。2009 年2010 年第一学期Java 高级编程期末试题A 卷时间共 120 分钟一、 填空题 Fillhe bls in each of the following sements: 24%(每空 1 分,共 24 分)1.2.3.Java applications begin execution at method .Each parameter must specify boReturn type _indicates(n)and a(n) .t a method will perform a task but will not return anyinformation
2、 when it completes its task.4.5.Types in Java are dividedo two categories _types and types.In Java, it issible to have several methods with the same namet each operate ondifferent types or numbers of arguments. This feature is called method .If a class declares constructors, the compiler will not cr
3、eate a(n) ..Keyword specifiest a variable is not modifiable.A(n) declaration contains a comma-separated list of constants.is a form of software reusability in which new classes acquire the members of existing classes and embellish those classes with new capabilities.10. A superclasss members
4、can be acsubclass declarations.sedhe superclass declaration and in11. Subclass constructors can call superclass constructors via the keyword.12. If a class containseast one abstract method, it is a(n) class.Classes from which objects can be instantiated are called classes.involves using a superclass
5、 variable to invoke methods on superclass andsubclass objects, enabling you to programeral.t do not provide implemen15. Methodst are noterface methods andions must bedeclared using keyword _.A(n) is used to walk through a collection and can remove elements from the collection during the iteration.Ja
6、va classes and provide the capabilities of array-like datastructurest can resize themselves dynamically.A(n) object is used to submit a query to a database.Class HttpServlet defines the methodsandto respond to get andtrequests from a cnt.20. HttpServletResponse methodobtains a character-based output
7、 streamtenables text dao be sent to the cnt二、 判断题(每题 2 分,共 20 分)(Se whether each of the following is true or false. Ilse, explain why. 20%)得分阅卷人得分阅卷人题 号一二三四总分得 分阅卷人a.An import declaration is not required when one class in a package uses anotherhe samepackage. b.Variables or methods declared wics mod
8、ifirivate are acsible only to methods ofthe class in which they are declared. c.Primitive-type local variables are initialized by default.( False. Primitive-type instancevariables are initialized by default) d.e.Reference-type instance variables are initialized by default to the value null. Any clas
9、sapplication. t contains public sic void main( String args ) can be used to execute anf.g.An array can store many different types of values. Expresarray.length is used to acs the number of arguments of a variable-lengthargument called array. h.i.Superclass constructors are not inherited by subclasse
10、s. When a subclass redefines a superclass method by using the same signature, the subclass issaid to overloadt superclass method. j.If a superclass declares an abstract method, a subclass must implementt method. 三、问答题(共 24 分)(Answer the following questions 24%)1 What is the difference betn an Abstra
11、ct class anderface?2 What is the return type of a programs main() method?3If an object is garbage collected, can ite reachable again?4. What is a void return type?5. Explain Basic Steps in writing a Java program using JDBC?6. How to call a stored procedure from JDBC?7. How to call orvlet from anothe
12、r servlet?得分阅卷人8. Why use JSP when we can do the same thing with servlets?四、选择题(1-10 每题 2 分 11-14 每题 3 分。共 32 分)(Multiple Choi32%)1. How can you force garbage collection of an object? ()A.B.C.D.E.Garbage collection cannot be forced. Call System.gc().Call System.gc() passing in a referenceto the obje
13、ct to be garbage collected. Call Runtime.gc().Set all referento the object tvalues(null, for exle).2.The class AssertionError has is - a relationship with these classes: ()A RuntimeExceptionB errorCVirtualMachineErrorDThrowable3. Which of the following collection classes from java.util package are T
14、hread safe? ()A VectorB ArrayListCHashMapDHashtable4. Which of the following sements regarding the Java programming languages Garbagecollection?(Check allt apply) ()A. It is done automaticallyB Programmers can call he System.gc() method to immediay invoke Garbage GollectionC It can vary across JVM i
15、mplemenionD It checks for and frees memory no longer neededE It ensurest memory leaks do not occur5. To which of the following sements does encapsulation refer? ()A The ability of an object to hide its data and methodB The ability for an object to behave differently depending on its typeC A way to d
16、efine new class by extending base classesD Ignoring or suppressing details to formulate a generic concept6. Which of the following sements are true about abstract classes? (Check allt apply)()得分阅卷人A Abstract classes cannot be instantiatedB Abstract classes can define constructor(s)C They can declare
17、 concrete as well as abstract methodsD Abstract classes can be extended by abstrawell as concrete subclasses7. Which of the following about the “default” acs control modifier is true? (Check alltapply) ()A It restricts acs withhe same classB It allows a member to be acsed from other classes residing
18、he same packageC It allows acs to a class member from a subclass residing in a different packageD It is more restrictivet the “Protected” keyword8. Which of the following must be the same in Overriding methods?(Check allt apply)()A NameB Argument listC Return typeD Exceptions throw9. Which of the fo
19、llowing are true about the List class?(Check allt apply)()A.A List is an unordered collectionB.No duplicates are permitted in a ListC.A List is an ordered collectionD.Duplicates are permitted in a List10. Which of the following about import sement is true? ()A Using an import sement is the only way
20、to refer to classes in a different packageB Import sements directly impact the runtime performanceC Import sement causes the compiler to load classes even if they are not referencedD They allow you to use class short names in your program11. What will happen when you attempt to compile and run the f
21、ollowing code? ()public class Test sicx = 5;sicx,y;public sic void main(String args) x-; myMethod();System.out.prln(x+y+ +x ); public sic void myMethod() y = x+ + +x; A Compile errorB prs 2C Prs 3D Prs 7E Prs 812. What will happen when you attempt to compile and run the following code?()class MyPare
22、nt x, y;MyParent(x,y)this.x = x;this.y = y;publicaddMe(x,y) return this.x + x + y + this.y; publicaddMe(MyParent myPar) return addMe(myPar.x, myPar.y); class MyChild extends MyParent z;MyChild (x,y,z)super(x,y);this.z = z;publicaddMe(x,y,z)return this.x + x + this.y + y + this.z + z;publicaddMe(MyChild myChi)return addMe(myChi.x, myChi.y, myChi.z); publicaddMe(x,y) return this.x + x + this.y + y; public class MySomeOne public sic void main(String args) MyChild my
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年预制箱涵可行性研究报告
- 体育招聘考试试题及答案
- 浅谈高校财务管理的创新
- 企业环保试题及答案
- 企业劳动安全试题及答案
- 仲裁法试题及答案
- 以太网试题及答案
- 人行考试真题及答案
- 2025年农村电商农产品上行模式与品牌建设研究报告:产业链优化分析
- 2025年农村电商农产品上行模式优化与品牌形象设计研究报告
- 初三中考数学最后一课-主题班会【课件】
- 2025照明系统工程合同样本
- 高内涵细胞分析系统应用
- 2025益阳市赫山区中小学教师招聘考试试题及答案
- 2025年原发性高血压知识试题
- 中国工业软件行业发展分析及发展趋势与投资前景预测研究报告2025-2028版
- 中国当代小说选读学习通超星期末考试答案章节答案2024年
- 收费站年度工作计划
- xx县精神病医院建设项目可行性研究报告
- 《在中亚细亚草原上》赏析 课件
- 班组会议运作技巧ppt课件
评论
0/150
提交评论