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

科目名稱:資訊系統 與網路導論 開課系所:資訊工程 學系 任課教師
吳坤熹
系所別:
年級:
學號:
姓名:
考試日期
2010.12.1

Open book; turn off computer & mobile phone                    (考試時間: 14:10-14:45)

  1. (10%) Consider the following binary representation of an unsigned short integer.  Convert it to a decimal number.

    10000000 00000001

  2. (10%) Determine whether the following code has syntax erros or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).

    #include <iostream>
    using std::cout;
    using std::endl;

    int main()
    {
        int sum=0, i = 0;
        do {
            sum += ++i;
        } while (i<=10);
        cout << i << '\t' << sum << endl;
        return 0;
    }


  3. (10%) Determine
    whether the following code has syntax erros or not.  If it is correct,
    predict its output.  If it is incorrect, point out the mistake(s).

    // This is similar to Quiz 2 in BASIC
    #include <iostream>
    using std::cout;
    using std::endl;

    int main()
    {
        const int MAX = 25;
        int a[MAX+1] = { 0 };
        int sum = 0;
        for (int i=1; i<=MAX; i++)
            for (int j=i; j<=MAX/i*i; j+=i)
                switch (a[j])
            {
                case 0:
                    a[j] = 1;
                    break;
                case 1:
                    a[j] = 0;
                    break;
            }
        for (int i=1; i<MAX; i++)
            sum += a[i];
        cout << sum << endl;
        return 0;
    }
  4. (10%) Determine
    whether the following code has syntax erros or not.  If it is correct,
    predict its output.  If it is incorrect, point out the mistake(s).

    #include <iostream>
    using std::cout;
    using std::endl;

    int main()
    {
        unsigned s = 1201;
        int i = (s >> 4) & ~(~0 << 3);
        cout << i << endl;
        return 0;
    }
  5. (10%) Determine whether the following code has syntax erros or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).
    #include <iostream>
    using std::cout;
    using std::endl;

    int main()
    {
        char name[] = "NCNU";
        int i = 0;
        while (name[i] != '\0')    
            name[i++] |= 0x20;
        cout << i << name << endl;
        return 0;
    }
  6. (10%) Determine whether the following code has syntax erros or not.  If it is correct, predict its output.  If it is incorrect, point out the mistake(s).
    #include <iostream>
    using std::cout;
    using std::endl;

    int main()
    {
        int a[5] = {1, 2, 3};
        int i = 0;
        for (i=0; i<5; a[i++] = i++)
            ;
        for (i=0; i<5; i++)
            cout << a[i] << endl;
        return 0;
    }
  7. (10%) 請問,為什麼看書的姿勢不正確,會使頭部對頸部造成重大影響?
    1. 因為人體頭部佔體重的1/10重量
    2. 因為人體頭部佔體重的1/5重量
    3. 因為人體頭部佔體重的1/20重量
  8. (10%) 請問,人體為什麼比貓,狗等動物更容易長骨刺?
    1. 因為人類體積比較大,體重比較重
    2. 因為人體脊椎是直立的,需要承受較多的地心引力所導致的壓力
    3. 因為人類飲食比較複雜
  9. (10%) 請問, 上星期五演講者所介紹的五項運動最適合在什麼時間做呢?
    1. 早上
    2. 晚上
    3. 傍晚
  10. (10%) 請問,哪種姿勢對腰部的壓力比較大?
    1. 坐姿
    2. 站姿
    3. 兩者相同