資訊處理 101 年程式語言概要考古題
題目為考試當年公告版本,實務標準請以現行規範為準。
以下為一C 程式,它有3 個變數宣告敘述(variable declaration statements):(16 分) ㈠試說明在A、B、C、D 四個標示出的位置中的可見變數(visible variable)。 ㈡這些可見變數分別是在那個敘述中宣告的? void example(void) { int u, v, w; /* declaration 1 */ ..... while (....) { int v, w, x; /* declaration 2 */ ..... /* <=== A */ while (....) { int w, x, y; /* declaration 3 */ ..... /* <=== B */ } ..... /* <=== C */ } ..... /* <=== D */ }
㈠在C++程式語言中,假設有一3 維陣列M,其各維度之最低指標(lowest subscript) 分別為L1、L2、L3,最高指標(highest subscript)分別為H1、H2、H3。若要存 取位於(i, j, k)之元素,試導出它的存取函式。(10 分) ㈡若換成FORTRAN 程式語言,存取函式又為何?(10 分)
試證明以下之語法是不明確的(ambiguous)。(16 分) <statement> Æ <assignment> <assignment> Æ <assignment> + <assignment> | <identifier> <identifier> Æ x | y | z
在程式語言Java 中如何去釋放(Deallocate)一個物件(Object)?於此釋放物件的 過程有何存在之問題?如何解決?(16 分)
試說明C++程式語言中例外處理(Exception Handling)的try construct。(16 分) 六、解釋下列名詞:(每小題4 分,共16 分) ㈠淺捆綁(Shallow binding) ㈡位元碼(Byte code) ㈢啟動錄(Activation record) ㈣動態堆疊變數(Heap-dynamic variable)