國立暨南國際大學 101 學年度第一學期小考試卷

科目名稱:計算機概 論 開課系所:資訊工程 學系 考試日期 2012.12.21
系所別:
年級:
學號:
姓名:
考試時間 08:30-08:50
  1. (10%) What is the main goal of Mozilla Foundation?
    1. To develop a faster web browser
    2. To make more money from web users
    3. To introduce proprietary features to web browsers
    4. To facilitate an open platform for all web users


  2. (10%) Determine whether the following code is correct or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).
    // Pointers to Functions
    #include <iostream>

    int sum(int a, int b)
    { return a + b; }

    int product(int a, int b)
    { return a * b; }

    int main()
    {
        int *pfun[2](int, int) = { sum, product };
        std::cout << pfun[1](3, 5) << std::endl;
        return 0;
    }

  3. (10%) Determine whether the following code is correct or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).
    // Default Values of Parameters
    #include <iostream>
    using std::cout;
    using std::endl;

    void print(int a = 10, int b = 12)
    { cout << a << b << endl; }

    void print(char c)
    { cout << static_cast<int>(c) << endl; }

    int main()
    {
        print(5);
        print('5');
        return 0;
    }