所屬科目:研究所、轉學考(插大)、學士後-計算機概論
( ) 1. Convert the decimal number 35.125 to the binary number _________. (A) 100011.01 (B) 10011.001 (C) 100011.001 (D) none of the above
( ) 2. Assuming that b is an array and bPtr is a pointer to that array, what expression refers to the address of the third element? (A) bPtr[2] (B) *b[2] (C) (bPtr+2) (D) none of the above
( ) 3. Change the 4-bit two’s complement number (1110)2 to decimal number (A) -6 (B) -2 (C) 14 (D) none of the above
( ) 4. _______ is an example of a functional language. (A) LISP (B) Prolog (C) C (D) Java
( ) 5. The compile stage takes place when ____________. (A) the C program is translated into machine language code (B) the program is placed in memory (C) sets of the program are formed sequentially (D) the object code is linked with code for functions in other files
1. HanoiTower problem
2. If we run the below program (in Fig.1) with the input “153”, then the output is__
3. If we run the above program (in Fig.2) with the input "1234", then the output is_.
(a) If we run the above program (in Fig.3) with the input n=6, then the output is_.
(b) If we run the above program (in Fig.3) with the input n=k, where k is an odd number, then the output is_.
5. Show the Excess3 representation of the decimal number -0.625 :__The format of Excess_3: the sign occupies 1 bit (0 for positive and 1 for negative), the exponent occupies 3 bits (using a bias of 3), the mantissa occupies 4 bits (unsigned number).
三、問答題 Problems (40%)
Given an array \( A \) with \( n \) integers \( A[0], A[1], ..., A[n-1] \), write a C program to find the maximum subsequence sum \( \sum_{k=i}^{j} A_k \), where \( 0 \le i \le j \le n-1 \).
For example: \( A[0] = -1, A[1] = 9, A[2] = -3, A[3] = 8, A[4] = -1 \) output the maximum subsequence sum \( (9)+(-3)+(8) = 14 \). (If you have many programs, choose the program with less running time.)
Given an integer k, write a C program to find the minimum number of Fibonacci numbers whose sum is equal to k.
For example: The Fibonacci numbers are: 1, 1, 2, 3, 5, 8, 13, ... If the input k = 7, we have 2 + 5 = 7. Then, we output 2.