




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、中國海洋大學(xué) 20072008學(xué)年 第2學(xué)期 期末考試試卷信息科學(xué)與工程學(xué)院面向?qū)ο蟮某绦蛟O(shè)計課程試題(A卷)優(yōu)選專業(yè)年級 學(xué)號 姓名 授課教師 座號 -裝-訂-線- 共3頁 第1頁考試說明:本課程為閉卷考試,可攜帶 文具(或本課程為開卷考試,可攜帶 文具和 資料),滿分為: 100分。 題號一二三四五六七總分得分一、(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 授課教師命題教師或命題負責(zé)人簽字 年 月 日院系負責(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è)計課程試題(A卷)優(yōu)選專業(yè)年級 學(xué)號 姓名 授課教師 座號 -裝-訂-線- 共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è)計課程試題(B卷)優(yōu)選專業(yè)年級 學(xué)號 姓名 授課教師 座號 -裝-訂-線- 共3頁 第1頁考試說明:本課程為閉卷考試,可攜帶 文具(或本課程為開卷考試,可攜帶 文具和 資料),滿分為: 100分。 題號一二三四五六七總分得分一、(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.授課教師命題教師或命題負責(zé)人簽字 年 月 日院系負責(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è)計課程試題(B卷)優(yōu)選專業(yè)年級 學(xué)號 姓名 授課教師 座號 -裝-訂-線- 共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等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《帝國定型》讀書感悟課件
- 甲方軟件開發(fā)合同協(xié)議
- 化妝品用乙基己基甘油市場分析:個人護理是其第一大應(yīng)用領(lǐng)域市場份額約45%
- 裁判員職業(yè)發(fā)展與考試試題及答案
- 《員工福利卡使用指南》課件
- 2024年體育經(jīng)紀人考試模擬測試與復(fù)習(xí)試題及答案
- 高級模具設(shè)計技巧考試試題及答案
- 強化認知裁判員試題及答案
- 2024年談目標裁判員試題及答案
- 針對性訓(xùn)練足球裁判員考試試題及答案
- 空天地一體化算力網(wǎng)絡(luò)資源調(diào)度機制
- 2024年計算機二級MS Office考試題庫500題(含答案)
- DL∕T 5863-2023 水電工程地下建筑物安全監(jiān)測技術(shù)規(guī)范
- DL∕T 846.11-2016 高電壓測試設(shè)備通 用技術(shù)條件 第11部分:特高頻局部放電檢測儀
- 心理壓力評分(PSS)問卷表
- CJJT177-2012 氣泡混合輕質(zhì)土填筑工程技術(shù)規(guī)程
- (高清版)JTGT 3374-2020 公路瓦斯隧道設(shè)計與施工技術(shù)規(guī)范
- DL-T 1476-2023 電力安全工器具預(yù)防性試驗規(guī)程
- 禁止強迫性勞工管理辦法
- 絕緣電阻測試記錄表(范本)
- 國家開放大學(xué)《心理健康教育》形考任務(wù)1-9參考答案
評論
0/150
提交評論