面向?qū)ο蟪绦蛟O(shè)計計科05c答案_第1頁
面向?qū)ο蟪绦蛟O(shè)計計科05c答案_第2頁
面向?qū)ο蟪绦蛟O(shè)計計科05c答案_第3頁
面向?qū)ο蟪绦蛟O(shè)計計科05c答案_第4頁
面向?qū)ο蟪绦蛟O(shè)計計科05c答案_第5頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、。裝。訂。線。2006 年2007 年第 1 學(xué)期 計科 04面象程序設(shè)計 試卷 C 卷時間共 120 分鐘一、填空題(每題 2 分,共 10 分)填空題1、寫出一個 C+的邏輯語句,如果 testScroe 的值大于或是等于 100,并且小于等于 200,則其取值為 true:(testScroe=100 &testScroe )。)控制結(jié)構(gòu)。2、3、4、使得某序列語句重復(fù)執(zhí)行的控制結(jié)構(gòu)稱為(循環(huán)在一個類中把另外一個類的一個對象定義為數(shù)據(jù)成員,這種機制稱為( 組合)。給出如下函數(shù),表達(dá)式 Func(2)的值是(14)。Func( /* in */if (n != 5)n ) return 3

2、 + Func(n + 1);elsereturn 5;5、在面象程序設(shè)計中,所謂的消息傳遞是指( 函數(shù)調(diào)用)。二、判斷題。把正確選項填入下面的表格的中,正確的標(biāo),錯誤的標(biāo)。(每題 2 分,共 20 分)F There is only one unique general solution (algorithm) for a given problem. c1T A programming language is said to be (case sensitive) if it considers uppercase letters to be different from lowercas

3、e letters.T If a C+ If sement begins with if (age = 30), the If condition is an assignment expres, not a relational1、2、3、expres.4、5、F An infinioop is one in which the While expresalways has the value false.T The code segmentcout response;while (response != Y & response != N) cout response;is equival

4、ent to the following code segment. docout response; while (response != Y & response != N);6、 F In C+, the express beta+ and +beta cways be usederchangeably.7、 F A C+ class can have at most one constructor.8、 F In C+, two different classes-say, MyClass and YourClass-cannot both have member functions

5、named Subtract.題號12345678910111213得分閱卷人得分閱卷人題號12345678910總分得分閱卷人9、 T The components of an array are all of the same daype.10、F A sequential search on a sorted list cannot be made quickern one on an unsorted list.11、F An inheritance hierarchy gives a visual picture of has-a relationships.12、F In C+,

6、a derived classs constructor is executed before its base class constructor is executed.13、F Given the following recursive formula, the value of F(3) is 11.F(N) = 2 + F(N - 1), if N 1and F(N) = 5, if N = 1三、選擇題。把正確選項填入下面的表格的中。(每題 3 分,共 54 分)、 B Which of the following translates a program written in a

7、 high-level language code?o machineA. a mouseB. a compilerC. an operating systemD. an editor2、 CWhich of the following terms describes the repetition of sements (instructions) while certain conditions are met?A. sequenceB. selectionC. looD. subprogram3、 B Which of the following is a legal string ass

8、ignment?A. name = Jones;B. name = Jones;C. name = 123 + Jones;D. b and c above4、 B Givent x is a float variable and num is anvariable containing the value 5, what will x contain afterexecution of the following sement:x = num + 2;A. 7B. 7.0C. 5D. 5.0E. nothing; a compile-time error occurs5、 A Which o

9、f the following sements abo+ stream input is true?When anfloating-poWhen aneger data value is read form.eger data value is reado a float variable, the value isconvertedoo a float variable, the float variablees anvariable.C. It is an error to read aneger data valueo a float variable.D. Input of a flo

10、ating-poE. c and d abovedata value stops when a decimal pois encountered.6、 E After execution of the following code, what will be the value o cin angle;if (angle 5)angle = angle + 5; if (angle 2)angle = angle + 10;le if the input value is 10?A. 0B. 5C. 10D. 15E. 257、 D What is the value of loopCount

11、 after control exits the following loop? loopCount = 1;while (loopCount = 145) alpha = alpha + 7; loopCount+;A. 1B. 144C. 145D. 1468、 D Given the function headingvoid GetNums(howMany,float& alpha,float& beta)which of the following is a valid function prototype fetNums?A. void GetNums(howMany, float&

12、 alpha, float& beta );B. void GetNums(, float&, float& );C.GetNums(, float&, float& );D. a and b aboveE. a, b, and c above題號12345678910111213得分閱卷人9、 C What is the output of the following code fragment? (beta is of type beta = 5;doswitch (beta)case 1 : cout R;break;case 2 :case 4 : cout O;break; case

13、 5 : cout 1); cout X;.)A. XB. ROOLXC. LOOXD. LOORXE. ROOX10、25.B What is the output of the following code fragment?string msg = HELP; cout msg2;A. EB. LC. HED. HELPHELPE. none of the above11、A Given the class declaration class MyClasspublic:.void Func(); private:n;what noion does the body of Func us

14、e to assign the value 3 to n?A. n = 3;B. MyCla= 3;C. MyClass:n = 3;D. someObject.n = 3;E. It cant be done-n is private.12、E A class SomeClass has a member function Fs no parameter list, returns anvalue, correctand does not modify any of the private data.Which of the following would be the function d

15、efinition for F?F() const .A.B. constF() .C. SomeClass:F() const .D. constSomeClass:F() .E.SomeClass:F() const .13、22.D Given the declarationlistVals7 = 10, 15, 20, 25, 30, 35, 40;a binary search is used to search the list for the value 35. In each iteration of the search loop, the index variablesmi

16、ddle, and last define the range of items being searched. When the search is finished, what is the value of,?(RememberA. 0t C+ arrays begin at index 0.)B. 2C. 3D. 4E. 514、20.D Consider the following C+ class declarations: class Xpublic:void Func1(); void Func2();private:m;class Y : public X public:vo

17、id Func3(); private:float f;How many public members does class Y have?A.0B.1C.2D.3E.415、24.B Supet class X has a class membert is an object of another class Y. If classes X and Y bothhave constructors, in what order will the constructors be executed when an object of class X is created?A.Xs construc

18、tor is executed, then Ys.B.Ys constructor is executed, then Xs.C.Both constructors are executed at the same time.E.Only Ys constructor is executed.D.Only Xs constructor is executed.16、27.A Supet a C+ class D is derived from a base class B. Class B has a public member function Func()t is not declared

19、 to be virtual, and class D reimplements Func(). At execution time, supe passed to the following function:void DoSomething( B& x ) x.Func();t a D object isWithhe DoSomething function, whose verof Func() is called?and b aboveA.Bs ver17、B In theB.Ds verC.boD.neither a nor b aboveobject-oriented design of an airline passenger reservation program, supet airplane seat,aisle seat, and window seat have been identified as objects. Focusing specifically on the aisle seat object,how does it relate to the airplaa

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論