




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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-2030年中国面包机行业市场发展现状及前景趋势分析报告
- 2025-2030年中国铣铜镁行业市场竞争格局及前景规模预测报告
- 2025-2030年中国铁路机车车辆配件制造行业竞争状况与发展趋势分析报告
- 2025-2030年中国贸易金融市场发展前景及未来趋势预测报告
- 2025-2030年中国调压箱市场发展前景及投资战略研究报告
- 2025-2030年中国蔬果加工产业发展现状规划研究报告
- 2025-2030年中国莫匹罗星市场运行现状及发展趋势预测报告
- 2025-2030年中国苜蓿草市场经营状况及投资战略报告
- 2025-2030年中国红土镍矿产业运营状况及发展规划分析报告
- 2025-2030年中国白金行业运行现状及发展前景预测报告
- 2024新版(外研版三起joinin)三年级英语上册单词带音标
- 纺织服装面料创意设计
- 四川义务教育三年级生命生态与安全教案下册
- EPC总承包项目工程设计各阶段的服务承诺
- 2024-2030年中国达克罗行业运行态势与前景展望分析报告
- 2024-2025学年小学美术一年级下册(2024)岭南版(2024)教学设计合集
- 2023届高考英语全国甲卷试卷讲评课件
- 第2课《“友邦惊诧”论》(教学设计)-【中职专用】高二语文同步课堂(高教版2024·拓展模块上册)(同课异构)
- 四川甘孜州招聘康定市投资发展集团有限公司招聘笔试题库2024
- 温州市瓯海旅游投资集团有限公司下属子公司招聘笔试题库2024
- 房屋买卖合同预交定金协议
评论
0/150
提交评论