# 計算機概論求解答

1. Which of the following is a black-box testing approach?

A. Basis path testing

B. Condition testing

C. Data flow testing

D. Random testing

E. All of the above

2. A2D array X[1...10][1...100] is declared in a program. The address of X[1][1] is 1200, and the size of each element of the array is 4. What address ofX[3][2] is if the memory system uses row-major storage?

A. 1232

B. 1264

c. 1328

D. 2408

E. None of the above

3. In the theory of computation, the halting problem states that,

A. All problems can be solved by one of the Turing machines.

B. can we write a program that tests whether or not any program, represented by its Gödel number, will terminate?

C. if an algorithm exists to do a symbol manipulation task, then a Turing machine exists to do a task.

D. the solvable problems can themselves be divided into two categories: polynomial and non-polynomial problems

E. None of the above

4. Consider the C program on the right side.(在下方) What will be printed on the standard output after the program finishes?

struct point {int x; int y;};

int main() {

struct point p, q;

struct point *r;

r=&q;

q.x = p.y = 1;

q.y = p.x = 2;

r->x = 2;

p.y=1;

printf(''%d, %d'',q.x, q.y);

return 0;

}

A. 2,2

B. 2,1

c. 1,2

D. 1,1

E. None of the above

5.Assume a computer system uses 7 bits to store a signed integer in two's complement format.

Then (0010010)2 - (0111010)2 =? (2應在括號右下角

A. (1011000)2

B. (1001100)2

c. (1110101)2

D. Overflow

E. None of the above

### 3 個解答

• sponge
Lv 6
5 年前
最佳解答

1.

black-box testing 指的是不必知道程式內部結構所進行的測試

答案中只有 D. Random testing 指輸入隨機產生，與程式內部無關

其他測試方法都針對程式內部的運作

2.

在 row-major 儲存方式中 X[3][2] 之前的儲存方式如下：

X[1][1], X[1][2], ..., X[1][100]

X[2][1], X[2][2], ..., X[2][100]

X[3][1], X[3][2]

也就是 X[3][2] 之前已有二個 row: X[1][1...100], X[2][1...100]

再加上 X[3][1], 總共 100+100+1=201 個元素

因此 X[3][2] 位址為 1200+4*201=2004, 答案中沒有這個選項

3.

halting problem 就是「是否有一般性的方法來決定程式面對某輸入是否會停止」

吻合的敘述為 B

4.

一開始 P, Q 資料未初始化，記做 P={?, ?}, Q={?, ?}, R 被指向 Q

q.x = p.y = 1; 後資料變為 P={?, 1}, Q={1, ?}

q.y = p.x = 2; 後資料變為 P={2, 1}, Q={1, 2}

r->x = 2; 因為 R 指向 Q 所以會改到 Q.x, 變成 Q={2, 2}

p.y=1; 對 P 值無影響，因為本來剛才就設 P.y = 1

printf 只印 Q 值，因此答案是 2, 2

5.

(0010010)2 - (0111010)2

= (0010010)2 + (1000110)2 // 將減數取 two's complement

= (1011000)2

因此答案為 A

希望如上回答對您有幫助！

• 登入以對解答發表意見
• 5 年前

台聯大的喔! (100年的

• 登入以對解答發表意見
• NG
Lv 7
5 年前

台北大學轉學考題？

中山大學轉學考題？

太久遠，都忘了

• 登入以對解答發表意見