Midterm Closed books, 不可以看書或任何東東, 請依序作答 10%I) Consider our Homework that converting infix expression to postfix: 5% a) 畫出在程式處理 35*2/(21-(12+5)+3)-8/4 之轉換時 STACK 變化的情形 5% b) 寫出該 postfix expression 5%II)Translate the following paragraph into Chinese. (譯為中文) A sort often consists of three parts: a comparison that determines the ordering of any pair of objects, an exchange that reverses their order, and a sorting algorithm that makes comparisons and exchanges until the objects are in order. The sorting algorithm is independent of the comparison and exchange operations, so by passing different comparison and exchange functions to it, we can arrange to sort by different criteria. This is the approach used in the C standard library function qsort(). 10%III) Suppose that IEEE floating standard(IEEE 754/854) is used to represent single precision floating number. (Note that Exponent is excess 127) (a) What does "IEEE" stand for? Write the English and 中文(2%) (Hint: the last "E" stands for Engineers 工程師) (b) Explain "Big endian" and "Little endian"? (2%) (c) Which byte order schema is ised in Intel-based PCs ? (2%) (d) Dipict the 32-bit patten for the decimal number 14.2 In addition to the 32-bit binary representation, also give it's hexadecimal representation in the form of 0x????????. (4%) 10%IV) Briefly answer the following questions: (a) Explain, with examples, the difference between "Rounding error" and "Truncation error"? (注意我們說過課本上1.7節的講法是錯的) (b) If an ECC (Error Correcting Code) can automatically correct the error when one bit of the data is error, what is the minimum Hamming distance of the code? (c) What are the time complexity of Insertion sort and Selection sort? (d) Discuss the time complexity of the quick sort? (e) Explain Java Applet and Java Application. 10% V) Briefly answeer the following questioons: (a) 解釋 destructor 並說明通常何時需要寫 destructor? (b) 舉例說明 overloading (分function name overloading與operator overloading) (c) 舉例說明 polymorphism, 並略述其與overloading 之差別 15%)VI.Consider the constructor, copy constructor, and assignment operator in the C++ programming language. Assume that we have the code: class Animal { double weight; public: Animal(){ cout << "AAA"; } Animal(int x){ cout << "III"; } Animal(Animal&x) { cout << "UUU"; } Animal& operator-(const Animal&y){cout<<"OOO";} Animal& operator=(const Animal&y){cout<<"EEE";} ~Animal(){cout <<" bye ";} }; Animal xx; Then, briefly answer the following questions: 1% (a) What output will caused by the statement "Animal aa(23);" ? 2% (b) What output will caused by the statements "Animal bb; bb=xx;" ? 2% (c) What output will caused by the statement "Animal cc(xx);" ? 2% (d) What output will caused by the statement "Animal dd=xx;" ? 5% (e) What about the statements "Animal ee(49); ee= xx - 38;" ? 3% (f) Explain the difference between overloading and polymorphism. 10%)VII. (a) Explain overloading and polymorphism with examples. 5% (b) Explain pure virtual function, abstract class, and ADT. 5% 15%)VIII. Design and Implement a class MyQueue using an array and two integers. You should implement your queue as a circular queue. a. 5%) Design 就是寫出該 class 的宣告部分, 通常寫成 .h header file. b. 5%) Implementation就是寫出該class所有函數的定義, 通常寫成.cpp檔) c. 5%) 解釋如何將之改寫為 template class? 15%) IX. Design and implement a template class for STACK. Discuss implementing STACK as an array and as an Linked List.