精華區beta TransCSI 關於我們 聯絡資訊
第一題我覺得怪怪的耶,不是只有負數才需要用補數表示嘛? 個人覺得.... 首先,-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 > -------------------------------------------------------------------------- < 作者: flashstar (閃亮的星) 看板: TransCSI 標題: Re: [考古] 中正-93 有錯請指正 時間: Wed Jun 15 23:48:05 2005 ※ 引述《dynamicy (小人物)》之銘言: : 第一題我覺得怪怪的耶,不是只有負數才需要用補數表示嘛? : 個人覺得.... : 首先,-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... 同學, 你這樣的觀念錯得很嚴重, 首先, 1's or 2's complement只是一種"表示法", 和負數沒關係, 而負數的表示法有 取1's 取2's sign-maganitude, 總之,取補數只是一個動詞, 就是"取"的動作而已, 別和負數搞混, 負數的表示法只是剛好有應用到取補數的動作, 故, 任何數都可以取補數, 若有運算上的需要. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.224.77.77 > -------------------------------------------------------------------------- < 作者: erichugh (轉阿轉~~) 看板: TransCSI 標題: Re: [考古] 中正-93 有錯請指正 時間: Fri Jun 17 16:13:14 2005 ※ 引述《dynamicy (小人物)》之銘言: : 第一題我覺得怪怪的耶,不是只有負數才需要用補數表示嘛? : 個人覺得.... : 首先,-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... 補數系統 能使用加法電路來實踐減法的計算 給定系統使用 5 bits來儲存資料 假設 有一個數 a = 9 化為2進位後 a = 01001 另一個數 b = 4 b = 00100 a+b ==> 9 01001 +4 +00100 --- ------- 13 01101 a-b ==> 9 01001 -4 →此時才取4的2's補數 = 11100 +11100 --- ------- 5 100101 ^^ 有進位 結果為正 b-a ==> 4 00100 -9 →9的2's =10111 +10111 --- ------- -5 11011 ^沒有進位 結果要再取補數找到答案 11011 是 5的2's 所以..答案是 -5 (ps.如果前面-9取的是1's 則答案是用1's逆運算) 總結: A,B > 0 A+B 直接算 A-B = A+(B的補數) ┬────有進位:為正 就是答案 │ └───沒有進位:為負 結果再取一次補數才是答案 -- ███◣ 上菜囉~~~ ◤◤◥ □︵□ 我是史上洨最多的特級廚師洨當家 ●~  ̄ ̄ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.216.182 > -------------------------------------------------------------------------- < 作者: dynamicy (小人物) 看板: TransCSI 標題: Re: [考古] 中正-93 有錯請指正 時間: Sat Jun 18 01:10:28 2005 這個我知道,不過還是多謝了, 後來去跟我們老師確認過了, 原則上是負數運算才需要補數, 所以原則上正數是不需要取補數的, 這提的話只是取補數這個action, 還是可以取, so...應該這樣子吧, 對了,這提的話,他沒有給位元數, 可以運算嘛? +1==>01 1's==>10 2's===>11 個人覺得應該是+1才對吧?.... ※ 引述《erichugh (轉阿轉~~)》之銘言: : ※ 引述《dynamicy (小人物)》之銘言: : : 第一題我覺得怪怪的耶,不是只有負數才需要用補數表示嘛? : : 個人覺得.... : : 首先,-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... : 補數系統 能使用加法電路來實踐減法的計算 : 給定系統使用 5 bits來儲存資料 : 假設 有一個數 a = 9 化為2進位後 a = 01001 : 另一個數 b = 4 b = 00100 : a+b ==> 9 01001 : +4 +00100 : --- ------- : 13 01101 : a-b ==> 9 01001 : -4 →此時才取4的2's補數 = 11100 +11100 : --- ------- : 5 100101 : ^^ : 有進位 結果為正 : b-a ==> 4 00100 : -9 →9的2's =10111 +10111 : --- ------- : -5 11011 : ^沒有進位 結果要再取補數找到答案 : 11011 是 5的2's : 所以..答案是 -5 : (ps.如果前面-9取的是1's 則答案是用1's逆運算) : 總結: : A,B > 0 : A+B 直接算 : A-B = A+(B的補數) ┬────有進位:為正 就是答案 : │ : └───沒有進位:為負 結果再取一次補數才是答案 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.170.38.85
erichugh:原po打錯了..但他的解釋是正確的..所以沒注意到140.115.216.182 06/18
erichugh:沒給位元也沒差別阿...不然所有系統只要加大位140.115.216.182 06/18
erichugh:元 豈不是整個系統架構思路都要重做...140.115.216.182 06/18
Elfiend:呃~抱歉,不小心打錯答案造成誤解...220.139.132.172 06/18