




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、中國海洋大學(xué) 20072008學(xué)年 第2學(xué)期 期末考試試卷信息科學(xué)與工程學(xué)院面向?qū)ο蟮某绦蛟O(shè)計(jì)課程試題(A卷)優(yōu)選專業(yè)年級(jí) 學(xué)號(hào) 姓名 授課教師 座號(hào) -裝-訂-線- 共3頁 第1頁考試說明:本課程為閉卷考試,可攜帶 文具(或本課程為開卷考試,可攜帶 文具和 資料),滿分為: 100分。 題號(hào)一二三四五六七總分得分一、(20 points)Multiple Choice1. is not a member function of a class.(A) Constructor (B) Destructor (C) Friend function2. is the earliest ancest
2、or of object-oriented programming languages.(A) C+ (B) Simula 67 (C) FORTRAN3. To assert that one class is a of another is to simply say it was built using inheritance. (A) subclass (B) subtype4. may be accessed directly through the instances of child class within the external function. (A) private
3、members in the parent class (B) protected members in the parent class (C) public members in the parent class5. To create an instance, the template argument must be associated with a . (A) type (B) number (C) character6. C+ has the space allocation strategy.(A) maximum static (B) minimum static (C) d
4、ynamic 7. In allocation, the amount of space required is determined at run-time .(A) stack-based (B) heap-based8. “<<” can be overloaded as function. (A) friend (B) member9. A is invoked automatically when an object is deleted.(A) constructor (B) destructor10. Overriding is resolved at time.(A
5、) run (B) compile 授課教師命題教師或命題負(fù)責(zé)人簽字 年 月 日院系負(fù)責(zé)人簽字年 月 日共3頁 第2頁二、(10 points)True/False( ) 1. Inheritance represents the has-a relationship. ( ) 2. All the member functions in the friend class are friend members for current class.( ) 3. Shadowing only occurs in the context of the parent/child relationshi
6、p.( ) 4. A type name can be used as an operator. ( ) 5. In object-oriented languages, the term polymorphism means there is one meaning and many different names.三、(16 points)Fill in the following blanks and write out the running results of function main.Suppose: (1) class Y is a private subclass of c
7、lass X;(2) class Z is a public subclass of class Y;(3) a, b and c are encapsulated data members.#include<iostream> class Xpublic: X(int x) a=x; void showX( )cout<<“a=”<<a<<endl; int a;class Y: private Xpublic: Y b=y;void showY( ) cout<<"a="<<a<<end
8、l; cout<<"b="<<b<<endl; X:showX( );private: int b;class Z: public Ypublic: Z c=z; void showZ( ) showY( ); cout<<"c="<<c<<endl;private: int c;int main( )Z obj(10, 20, 30); obj.showX( ); obj.showY( ); obj.showZ( ); return 0; 中國海洋大學(xué) 20072008學(xué)年 第2學(xué)
9、期 期末考試試卷信息科學(xué)與工程學(xué)院面向?qū)ο蟮某绦蛟O(shè)計(jì)課程試題(A卷)優(yōu)選專業(yè)年級(jí) 學(xué)號(hào) 姓名 授課教師 座號(hào) -裝-訂-線- 共3頁 第3頁四、(14 points)Please write out the class definitions of Student and GraduateStudent.五、(20 points) Please write out the class definitions of Shape, Cube, Sphere and draw the diagram of inheritance hierarchy.六、(20 points)Please imple
10、ment the addition of two matrices, which has 2 rows and 3 columns.中國海洋大學(xué) 20072008學(xué)年 第2學(xué)期 期末考試試卷信息科學(xué)與工程學(xué)院面向?qū)ο蟮某绦蛟O(shè)計(jì)課程試題(B卷)優(yōu)選專業(yè)年級(jí) 學(xué)號(hào) 姓名 授課教師 座號(hào) -裝-訂-線- 共3頁 第1頁考試說明:本課程為閉卷考試,可攜帶 文具(或本課程為開卷考試,可攜帶 文具和 資料),滿分為: 100分。 題號(hào)一二三四五六七總分得分一、(12 points)Multiple Choice1. is not a member function of a class.(A) Const
11、ructor (B) Destructor (C) Friend function2. is the earliest ancestor of object-oriented programming languages.(A) C+ (B) Simula 67 (C) FORTRAN3. is a valid identifier in C+.(A) 2006Year (B) E-mail (C) idNumber# (D) _age4. Storage for variable is allocated at block entry and destroyed at block exit.(
12、A) global (B) static (C) automatic5. may be accessed directly through the instances of child class within the external function. (A) private members in the parent class (B) protected members in the parent class (C) public members in the parent class 6. is a manipulator used to determine the number o
13、f character positions in which to display a right-justified number.(A) setw (B) setprecision (C) fixed (D) endl 二、(12 points)True/False( ) 1. Composition represents the is-a relationship. ( ) 2. If the parent class is virtual , there is only one copy in the child classes.( ) 3. Destructors can be ov
14、erloaded. ( ) 4. Shadowing only occurs in the context of the parent/child relationship. ( ) 5. Overloading is resolved at run time.( ) 6. The implementation of dynamic polymorphism relies on virtual functions.授課教師命題教師或命題負(fù)責(zé)人簽字 年 月 日院系負(fù)責(zé)人簽字年 月 日共3頁 第2頁三、(16 points)Please fill in the following blanks a
15、nd write out the running results of function main:#include<iostream>using namespace std;class Basepublic: Base(int sa) a=sa; cout<<“Constructing Base, a=”<<a<<endl;private: int a;class Base1:virtual public Basepublic: Base1(int sa,int sb): b=sb; cout<<“Constructing Base
16、1, b=”<<b<<endl;private: int b;class Base2:virtual public Basepublic: Base2(int sa,int sc): c=sc; cout<<“Constructing Base2, c=”<<c<<endl;private: int c;class Derive: public Base1, public Base2public:Derive(int sa,int sb, int sc,int sd): d=sd;cout<<“Constructing D
17、erive, d=”<<d<<endl;private: int d;int main( )Derive obj(2, 4, 6, 8); return 0;中國海洋大學(xué) 20072008學(xué)年 第2學(xué)期 期末考試試卷信息科學(xué)與工程學(xué)院面向?qū)ο蟮某绦蛟O(shè)計(jì)課程試題(B卷)優(yōu)選專業(yè)年級(jí) 學(xué)號(hào) 姓名 授課教師 座號(hào) -裝-訂-線- 共3頁 第3頁四、(20 points)Please implement the addition of two fractional values.五、(20 points)Please write out the class definition of PartTime _Student and draw the diagram of inheritance hierarchy.六、(20 points)Class person h
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 化學(xué)競(jìng)賽的力量
- 寒露氣候農(nóng)業(yè)指導(dǎo)
- 2025至2030年中國造粒輔機(jī)市場(chǎng)分析及競(jìng)爭(zhēng)策略研究報(bào)告
- 2025至2030年中國自行車輔助輪支架市場(chǎng)調(diào)查研究報(bào)告
- 2025至2030年中國照明電器箱數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國P+R手機(jī)按鍵數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025-2035年全球及中國骨導(dǎo)耳機(jī)行業(yè)市場(chǎng)發(fā)展現(xiàn)狀及發(fā)展前景研究報(bào)告
- 2025-2035年全球及中國履帶鞋行業(yè)市場(chǎng)發(fā)展現(xiàn)狀及發(fā)展前景研究報(bào)告
- 2025年工藝禮品加工設(shè)備合作協(xié)議書
- 2025年燈頭項(xiàng)目建議書
- 2025年皖北衛(wèi)生職業(yè)學(xué)院單招職業(yè)技能測(cè)試題庫參考答案
- 2024年廣州市公安局招聘交通輔警考試真題
- 隨機(jī)交易策略(TB版)
- 1.1 銳角三角函數(shù)(第1課時(shí)) 課件 2024-2025學(xué)年北師大版九年級(jí)數(shù)學(xué)下冊(cè)
- 2025年分手協(xié)議書規(guī)范承諾函
- 椎管打骨水泥后的護(hù)理
- 中國民航大學(xué)《普通物理專題》2023-2024學(xué)年第一學(xué)期期末試卷
- 2025版年度城市綠化活動(dòng)策劃及實(shí)施服務(wù)合同范本
- 2025年誠通證券招聘筆試參考題庫含答案解析
- 2025年全國高考體育單招政治時(shí)事填空練習(xí)50題(含答案)
- 人教版高一上學(xué)期數(shù)學(xué)(必修一)期末考試卷(附答案)
評(píng)論
0/150
提交評(píng)論