English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

1What is the pointer syntax equilvalent of the following?

book[i] = manuscript[j];

a. *book = *manuscript;
b. *(book + i) = *(manuscript + j);
c. *book + i = *manuscript + j;
d. book + i = manuscript + j;

2 Pointers may be assigned which of the following?

a. all integer values
b. an address
c. NULL
d. both (b) and (c)

3 Which of the following is a repetition structure?

a. if
b. if/else
c. do/while
d. switch

4 Assuming that you have an integer instance variable named "fuelLevel", what is the proper code for a "set" method for that instance variable?

a. void setFuelLevel(int fuelLevel) {
this->fuelLevel = fuelLevel;
}

b. void setFuelLevel(int fuelLevel) {
fuelLevel = fuelLevel;
}

c. int setFuelLevel(int fuelLevel) {
return fuelLevel;
}

d. int setFuelLevel(int fuelLevel) {
this->fuelLevel = fuelLevel;
}

5 What will the following method output, assuming it is called three times in
succession?

void foo() {
static int x = 8;
cout << x--;
}

a. 8 7 6
b. 876
c. 765
d. 8910

2006-11-07 23:16:22 · 5 個解答 · 發問者 GodFromHell 1 in 電腦與網際網路 程式設計

5 個解答

1. b
2. d
3. c
4. a
5. b

2006-11-08 10:57:31 · answer #1 · answered by ? 2 · 0 0

第四題是 a
在物件導向的類別裡,設值(set)方法的回傳值是void(無效值型態)。
取值(get)方法的回傳值是參數型態。
上面有this的說明。

2006-11-12 01:45:34 · answer #2 · answered by Big_John-tw 7 · 0 0

第四題答案a,
this->fuelLevel = fuelLevel;
設member variable 的值

2006-11-10 08:11:59 · answer #3 · answered by ? 4 · 0 0

1.d
2.d
3.c
4.c /*這題我不怎麼確定*/
5.b

2006-11-08 08:24:19 補充:
更正1.應該是 b

2006-11-08 03:16:26 · answer #4 · answered by 過路人 4 · 0 0

2d 3d 4c 5b

2006-11-07 23:44:27 · answer #5 · answered by Randy 1 · 0 0

fedest.com, questions and answers