精華區beta NTU-Exam 關於我們 聯絡資訊
課程名稱︰計算機概論 課程性質︰必帶(資工系必修) 課程教師︰周承復 開課學院:電資學院 開課系所︰資工系 考試日期(年月日)︰97/1/14 考試時限(分鐘):120分鐘(幾乎都會提早交卷) 是否需發放獎勵金:是 (如未明確表示,則不予發放) 試題 : 1. Please answer the result of r. #include<stdio.h> int f(int n) { if(n==0) { return 1; } else { return f(n-1)+f(n-1); } } void main() { int r; r=f(5); printf(" %d\n",r); } 2. Please build a binary search tree for the list {4,6,2,7,8,61,5}(from left to right) 3. What is the concept of selection sort(write down its algorithm)? 4. Can ququq be implemented by stack (e.g., push ans pop operations)? If it does, please describe how to achieve it. 5. Please outline each state of quicksort of the list {9,20,6,10,14,8,60,11} 6 a. What is operating system? b. What is multiprogramming? c. What is a real-time system? d. What is timesharing? e. What is address binding? 7.Use the following state of memory ┌────────┐ │Operating system│ ├────────┤ │ Process 1 │ ├────────┤ │Empty 60 blocks │ ├────────┤ │ Process 2 │ ├────────┤ │ Process 3 │ ├────────┤ │Empty 52 blocks │ ├────────┤ │Empty 100 blocks│ └────────┘ If the partitions are fixed and a new job arrives requiring 52 blocks of main memory, show memory after using each of the following partition selection approaches: A. First fit B. Best fit C. Worst fit 8. Use the following table of processes. Draw a Gantt chart that shows the completion times for each process using first-come/first-served CPU scheduling, shortest job next CPU scheduling and round robing CPU scheduling with slice of 60. Process Service time P1 120 P2 60 P3 180 P4 50 P5 300 9. Use the following list of cylinder requests (They are listed in the order in which they were received.) to answer the following questions. 40, 12, 22, 66, 67, 33, 80 a. List the order in which these requests are handled if the FCFS algorithm is used. Assume that the disk is positioned at cylinder 50. b. List the order in which these requests are handled if the SSTF algorithm is used. Assume that the disk is positioned at cylinder 50. c. List the order in which these requests are handled if the SCAN algorithm is used. Assume that the disk is positioned at cylinder 50 and the read/write heads are moving toward the higher cylinder numbers. 10. Please outline a method to approximate the median of 11 numbers by using min and max function. -- 最後一題的min/max function 可以吃無限個參數, 助教的Hint是期中考那題,(不太記得題目了) 我想他要問的應該是當「只」能用min/max function時,要怎麼找中位數, 我寫的答案是挑6個數取max,再用這些max值取min。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.31.128.188