版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、。装。订。线。2009 年2010 年第一学期Java 高级编程期末试题C 卷时间共 120 分钟一、单项选择题(每题 2 分,共 20 分)Which is valid returnType for methodA in line 2? (public class ReturnIt)2)3)4)5) AreturnType methodA(byte x, double y) return (double)x/y*2;B shortC floatD doublet y=ax3+8, which of the following are correct Java s2.Givenements f
2、or this equation?A y = a * ( x * x *x )+8; B y = a * x * x *( x +8);C y = ( a * x )* x *( x +8 ); D y = a * x * ( x *x +8 );3When throwing an exception, which keyword should be used ()A transientB finallyC throwD sic4.public class ConstOver public ConstOver(x,y,z)whiethod overload the ConstOver cons
3、tructor (A.ConstOver()B.protectedConstOver()C. public Object ConstOver(x,y,z)D.public void ConstOver(byte x, byte y, byte z)5. Whicherface is implemented by classes HttpServlet and GenericServlet?()AServletB HttpServletRequestC HttpServletResponseD ServletException6. We will create an instance of cl
4、ass ArrayList which extends theerface List, then which of thefollowings is right?()A ArrayList myList=new Object(); B List myList=new ArrayList();C ArrayList myList=new List(); D List myList=new List();得分阅卷人题 号一二三总分得 分阅卷人7. What is is a relation ()A. publicerface Colorpublic class Shprivate Color co
5、lor;B.erface Componentclass Container implements Component private Component children;C.public class Speciespublic class Animalprivate Species species;D.erface Aerface Berface C implements A,B8. After Execution, what are the value for i and j? ( i=1,j=10;doif(i+-j) continue;while(i= 0 & h = 0 & m =
6、0 & s 60)?s:0);/ get hour valuepublicgetHour()return hour;/ get minute valuepublicgetMinute()return minute;/ get second valuepublicgetSecond()return second; / end class Time22. Please use algorithm sort to order the elements of a List in descending order./ Using algorithm sort.(15 分)import import im
7、port publicjava.util.List; java.util.Arrays; java.util.Collections; class SortAlgorithmnprivate sicfinal String suits = Diamonds, Clubs, Spades ;array suits elements in descending order Hearts,/ sort and prpublic void sort_prElements() / end method sort_pr / end class SortAlgorithmnElements3. Roll a
8、 six-sided die 6000 times and count the roll value 1-6. Please comments. (15 分)import java.util.Random;public class RollDiepublic sic void main( String args )Random randomNumbers = new Random(); / random number generator frequency1 = 0; / count of 1s rolledfrequency2 = 0; / count of 2s rolled freque
9、ncy3 = 0; / count of 3s rolled frequency4 = 0; / count of 4s rolled frequency5 = 0; / count of 5s rolled frequency6 = 0; / count of 6s rolled face; / stores most recently rolled value/ summarize results of 6000 rolls of a dieplish the program according to thefor (roll = 1; roll = 6000; roll+ ) / end
10、 forSystem.out.pr System.out.prln( FacetFrequency ); / output headersf( 1t%dn2t%dn3t%dn4t%dn5t%dn6t%dn,frequency1, frequency2, frequency3, frequency4, frequency5, frequency6 ); / end main / end class RollDie4. Class GradeBook represents a grade book used by a professor to store andyze a set of stude
11、nt(15 分)grades.grades. Pleaseplish the define of methods according to the comments./ GradeBook.java, Grade book public class GradeBookprivate String courseName;using an array to store test/ name of course this GradeBook represents/ array of student gradesprivategrades;/ two-argument constructor init
12、ializes courseName and grades arraypublic GradeBook( String name,courseName = name; grades = gradesArray;gradesArray )/ method to set the course namepublic void setCourseName( String name )courseName = name; / store the course name/ method to retrieve the course name public String getCourseName()return courseName;/ perform various operationson the datapublic void pro/ call method System.out.prsGrades()getAverage to f( nClasscalculate the average gradeaverage and getis %.2fn, um%dnHighestgetAverage() );/ call methods getMinimumSystem.out.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 广西壮族自治区特种设备检验研究院2025年下半年公开招聘工作人员备考题库参考答案详解
- 厦门大学附属第一医院漳州招商局开发区分院2025年第四批公开招聘编外工作人员备考题库及1套参考答案详解
- 2026年医院清真食堂装修合同
- 2026年线上咨询机构合同
- 宁海农村商业银行2026年招聘10人备考题库及完整答案详解1套
- 2025年滁州市公安机关公开招聘警务辅助人员50人备考题库有答案详解
- 航天科工微电子系统研究院有限公司2026年校园招聘5人备考题库完整答案详解
- 中微公司核心装备技术领先研发与团队夯实成长根基
- 2025年杭州极弱磁场重大科技基础设施研究院校园招聘备考题库及参考答案详解一套
- 中国人民银行清算总中心所属企业城银清算服务有限责任公司2026年校园招聘16人备考题库带答案详解
- 2025年滁州市公安机关公开招聘警务辅助人员50人备考题库及一套参考答案详解
- 2025年云南省人民检察院聘用制书记员招聘(22人)备考笔试题库及答案解析
- 2026届四川凉山州高三高考一模数学试卷试题(含答案详解)
- 银行党支部书记2025年抓基层党建工作述职报告
- 肿瘤标志物的分类
- 2025山西忻州市原平市招聘社区专职工作人员50人考试历年真题汇编附答案解析
- 中药煎煮知识与服用方法
- 2026东莞银行秋季校园招聘备考题库及答案详解(基础+提升)
- 消防水泵房管理制度及操作规程
- 野战军生存课件
- 《民航概论》期末考试复习题库(附答案)
评论
0/150
提交评论