第一題我覺得怪怪的耶,不是只有負數才需要用補數表示嘛?
個人覺得....
首先,-2==>1010 的1's是 1101 2's是1110
-1==>1001 的1's是 1110 2's是1111
+2==>0010 1's和2's應該都是同型
+1==>0001 同上
(應該沒記錯...只有負數才有補數)
這樣的話...不就是無解?...orz...
※ 引述《Elfiend (小孩)》之銘言:
: (3) 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: 218.170.45.182