java高級(jí)編程計(jì)科061-20910第一學(xué)期-c_第1頁(yè)
java高級(jí)編程計(jì)科061-20910第一學(xué)期-c_第2頁(yè)
java高級(jí)編程計(jì)科061-20910第一學(xué)期-c_第3頁(yè)
java高級(jí)編程計(jì)科061-20910第一學(xué)期-c_第4頁(yè)
java高級(jí)編程計(jì)科061-20910第一學(xué)期-c_第5頁(yè)
已閱讀5頁(yè),還剩1頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(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ú)特殊說明,都需要本地電腦安裝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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論