國立暨南國際大學 100 學年度第二學期小考試卷                   (考試時間: 09:10-09:20)
科目名稱:資訊系統 與網路導論 開課系所:資訊工程 學系 任課教師
吳坤熹
系所別:
年級:
學號:
姓名:
考試日期
2012.5.4
  1. (10%) Determine whether the following code has syntax errors or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).
    // Double-Ended Queue
    #include <iostream>
    #include <deque>

    using std::cout;
    using std::endl;
    using std::deque;

    int main()
    {
    deque<int> data;
    data.push_back(9);
    data.push_front(5);
    data.insert(data.begin()+1, 2, 7);
    for (auto iter = data.begin(); iter != data.end(); iter++)
    cout << *iter << ' ';
    cout << endl;
    return 0;
    }






  2. (10%) Determine whether the following code has syntax errors or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).
    // Capacity of a container
    #include <iostream>
    #include <vector>

    using std::cout;
    using std::endl;
    using std::vector;

    int main()
    {
    vector<int> data(100);
    data.reserve(50);
    cout << data.capacity() << endl;
    return 0;
    }



  3. (10%) Alex McDowell invited John Underkoffler to design a user interface which appeared in a movie, whose title is
    1. Star Trek
    2. Star War
    3. Minority Report
    4. Harry Potter