美國大學 C 練習題 Part1

2007-02-02 3:20 pm
過幾天要考期末了,老師跟本沒給這50題練習題的答案,請各位高手幫幫忙, 因為題目會類似.
Cisc 192 Practice questions

1. A pointer is a variable which contains
a. signed float data
b. signed integer data
c. unsigned float data
d. unsigned integer data
e. signed character data

2. T/F. Data inside a class may be hidden from access
by functions outside the class body.

3. Assuming that spread[] is a one-dimensional
array of type int, which of the following
refers to the value of the third element in the array?

a. *(spread+2) b. *(spread+4)
c. spread+4 d. spread+2

4. T/F. A reference variable may be made to point to several
different objects at different times during the run of the
program.

5. T/F. One of the reasons for using classes
is that code may be more easily re-used
instead of re-written.

6. T/F. Polymorphism consistes of having several
methods or functions with the same name
and different argument lists.

7. Which option stores a 0 in int variable ch,
assuming the address of ch has been assigned to
the pointer fingerch?

a. *fingerch = 0 ;
b. int *fingerch = 0 ;
c. *finger = 0 ;
d. &ch = 0 ;
e. *ch = 0 ;

8. T/F. Code for member functions in a class
can be written outside the class' braces with only
their prototypes inside the class declaration.

9. T/F. A union allows several different types of
variable to share the same memory.

10. T/F. It is possible to successfully write a
function yet not know how many parameters will be
passed to it by the calling routine.
更新1:

我們老師都教我們自己看

回答 (1)

2007-02-02 5:10 pm
✔ 最佳答案
1. d
2. T
3. a
4. T,但你老師有教嗎?它是在較複雜的 OO 技巧才可以,不然是F。
5. T
6. T
7. c
8. F (不確定)
9. T
10 T 但你老師有教嗎?它是在較複雜的 C 裡。

2007-02-02 09:12:14 補充:
10 就像 printf( ) 一樣,它的參數個數未知。

2007-02-03 08:49:45 補充:
因為不能寫意見,而你和小綿羊都不接受來信,只好寫在這裡。

11. 是 T, 007 是 8 進位的7 剛好和 10進位 7 同。
 struct 可以那樣給初值。
 若改成 017,初值會是 15,而不是 17。
 因為是 8 進位!

13. 小綿羊是對的,但說明會讓人誤會。
 switch 執行效率高於 〝連續大量的〞if。

14. MOST often,只好選 b 了。
 那應該要算題目出得不好。
 因用了 most ,答案只能是單數!

20. 也是題目出得不好!!
 愛用前者而不用後者,速度是原因。但不一定是主因。


收錄日期: 2021-04-27 17:16:20
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070202000010KK01488

檢視 Wayback Machine 備份