lawpalyer logo

資訊處理 101 年程式語言概要考古題

民國 101 年(2012)資訊處理「程式語言概要」考試題目,共 5 題 | 資料來源:考選部

0 題選擇題 + 5 題申論題

以下為一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)