作者Elfiend (小孩)
看板TransCSI
标题[考古] 中正-93 有错请指正
时间Sun Jun 12 21:47:05 2005
(4) 1.which value can be added to 1's complement to get 2's complement?
(1) -2 (2) -1 (3) +2 (4) +1
答:1's complement的负数 +1 就得到 2'complement的负数
(4) 2.Which of the following memory components has the fastest access speed?
(1) SRAM (2) Cache (3) DRAM (4) Register
答:存取速度:Register > Cache > SRAM = DRAM
(2) 4.Which of the following is not a binary logic gate?
(1) AND gate (2) Tri-state buffer (3) Inverter (4) Half-adder
答:Inverter是not gate吧,half-adder也是逻辑电路组成的吧。
Tri-state buffer 我只知道後面是暂存器~前面那个就不知道了。
(1) 5.Given two 4-bit numbers:0110 and 1011,what is the result of adding
them together if they are signed magnitude?
(1) 0001 (2) 0011 (3) 1101 (4) 1011 (5) 1001
答:如果1011是用二的补数表示,则为-5 6+(-5) = 1
直接加则是 10001 第一个1溢位删掉 就是0001
(3) 8.Different parts of the large task may be executed by different
processors . What is this architecture?
(1) SISD (2) SIMD (3) MIMD (4) MISD (5) none of above
(4)10.A linked list has the functions insertAtFront,removeFromFront,
insertAtBack,and removeFromBack,which perform operations on nodes
exactly as their names describe. Which two functions would most
naturally model the operation of a queue?
(1) insertAtBack and removeFromBack .(2) inertAtBack and removeFromFront.
(3) insertAtFront and removeFromFront.(4) inertAtFront and removeFromBack .
答: 序列是先进先出。所以在头加入、在尾删除。
(3)11.If the macro
#define RECTANGLE_AREA(x,y)((x)*(y))
has been defined. then the line
rectArea = RECTANGLE_AREA( a+4,b+7) ; will be expanded to
(1) rectArea = 11 ; (2) rectArea= (a+4*b+7);
(3) rectArea = ((a+4)*(b+7)); (4) RECTANGLE_AREA(a+4,b+7);
(4)12.Given the preprocessor directive
#define HAPPY(x) printf ("happy,"#x"\");
How would you invoke this macro to generate a statement that would
print Happy BIRTHDAY (followed by a newline) at execution time?
(1) Happy(Birthday) (2) Happy(BIRTHDAY)
(3) HAPPY(Birthday) (4) HAPPY(BIRTHDAY)
简答题:
14. Convert 110101 to hex and decimal.
答:1*2^5 + 1*2^4 + 1*2^2 + 1*2^0 = 53 in decimal
53 = 3*16^1 + 5*16^0 = 35 in hex
15. Suppose a communication line is being used to transmit data serially
at 28,800 bps. If a burst of interference lasts 0.01 second, how many
data bits would be affected?
答:传送速率: 28800 bits/每秒 所以0.01秒就有 288 bits被影响无法传送
16. Suppose a time-sharing operating system is allotting time slices of
50 milliseconds.It normailly takes 8 milliseconds to position a disk's
read/write head over the desired track and another 17 milliseconds for
the desired data to rotate around to the read/write head.
(1)How much of program's time slice can be spent waiting for a read
from a disk to take place?
(2)If the machine is capable of executing ten instructions each
microsecond, how many instructions can be executed during this
waiting period?
答:(1)-寻觅时间:8 milliseconds 转动延迟:17 milliseconds
所以存取时间 = 8+17 = 25 千万秒 是半个 time slices
(2)-25千万秒 除上 微秒/10 = 25 * 10^7 / 10^(-7) = 25 * 10^14
我是否误会milliseconds的意思?? 另外(1)的take place是指?发生?
17. A hash file using the division hash function,i.e.divided by number
of buckets, is to be constructed with 50,51,52,or 53 buckets.
Which of these choices is best? Why?
答:53,因为是质数,与0~52皆互质,不会特别容易得到某个余数。
18. Suppose we have 41 buckets. What is the probability of the first eight
entries being placed in empty buckets by the division hash function?
答: 41*40*39*38*37*36*35*34 / 41^8
19. Is the bubble sort algorithm a P-problem? Why?
答:是,因为泡沫排序法属於Θ(n^2),所以是多项式问题。
20. Is the bubble sort algorithm a NP-problem? Why?
答:是,因为任一多项式问题皆可加入非既定指令且不影响其效能。
21. A program performs modules A,B,C, and D. Each has executing time
N,NlogN+N,N^2,and 2^N respectively. What is the Big-O complexity
of the overall program?
答:A→O(N) B→(NlogN+N) C→(N^2) D→(2^N)
22. Write a recursive function reverse_string to reverse a string by C.
For example, char[] = "ABCDEFGH";
printf("%s/n",a); /*"ABCDEFGH*/
reverse_string(a);
printf("%s/n",a); /*"HGFEDCBA*/
答: void reverse_string (chat a[]){
char string[];
int m=0,n=0;
while(a[m]!='\0'){ m++; }
m--;
while(m>=0){
string[n]=a[m]
m--;
n++;
}
while(n>=0){
a[n]=string[n]
n--;
}
}
--
以上有错请指正~ 缺的题目~会在下篇~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.138.221.177
※ 编辑: Elfiend 来自: 220.139.132.172 (06/18 20:05)