版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、。裝。訂。線。2009 年2010 年第一學(xué)期Java 高級(jí)編程期末試題C 卷時(shí)間共 120 分鐘一、單項(xiàng)選擇題(每題 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();得分閱卷人題 號(hào)一二三總分得 分閱卷人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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 餐桌禮儀課程設(shè)計(jì)
- 鐵釘技術(shù)裝和課程設(shè)計(jì)
- 銑床類課程設(shè)計(jì)
- 革命傳統(tǒng)類課程設(shè)計(jì)
- 生化檢驗(yàn)課程設(shè)計(jì)
- 軋制課程課程設(shè)計(jì)方案
- 送水泵站課程設(shè)計(jì)泵站圖
- 跆拳道海報(bào)特色課程設(shè)計(jì)
- 計(jì)算機(jī)網(wǎng)絡(luò)系統(tǒng)課程設(shè)計(jì)
- 閃爍的led課程設(shè)計(jì)
- 外呼合作協(xié)議
- 小學(xué)二年級(jí)100以內(nèi)進(jìn)退位加減法800道題
- 2025年1月普通高等學(xué)校招生全國(guó)統(tǒng)一考試適應(yīng)性測(cè)試(八省聯(lián)考)語(yǔ)文試題
- 《立式輥磨機(jī)用陶瓷金屬?gòu)?fù)合磨輥輥套及磨盤(pán)襯板》編制說(shuō)明
- 保險(xiǎn)公司2025年工作總結(jié)與2025年工作計(jì)劃
- 育肥牛購(gòu)銷合同范例
- 暨南大學(xué)珠海校區(qū)財(cái)務(wù)辦招考財(cái)務(wù)工作人員管理單位遴選500模擬題附帶答案詳解
- DB51-T 2944-2022 四川省社會(huì)組織建設(shè)治理規(guī)范
- 2024北京初三(上)期末英語(yǔ)匯編:材料作文
- 2023年輔導(dǎo)員職業(yè)技能大賽試題及答案
- 禮儀服務(wù)合同三篇
評(píng)論
0/150
提交評(píng)論